notishell / android-apktool

Automatically exported from code.google.com/p/android-apktool
0 stars 0 forks source link

java.lang.NullPointerException on compiling #187

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.Encoding the decoded apk
2.Try the latest version of poweramp available here
3.After decoding (which works properly) encoding even the unmodified apk 
results in error

What is the expected output? What do you see instead?
I: Baksmaling...
I: Loading resource table...
I: Loaded.
I: Loading resource table from file: C:\Users\Joel\apktool\framework\1.apk
I: Loaded.
I: Decoding file-resources...
I: Decoding values*/* XMLs...
I: Done.
I: Copying assets and libs...
I: Checking whether sources has changed...
I: Smaling...
Exception in thread "main" java.lang.NullPointerException
        at org.jf.util.PathUtil.getRelativeFile(PathUtil.java:44)
        at org.jf.smali.smaliFlexLexer.getSourceName(smaliFlexLexer.java:2569)
        at org.jf.smali.smaliFlexLexer.getErrorHeader(smaliFlexLexer.java:2661)
        at org.jf.smali.smaliFlexLexer.nextToken(smaliFlexLexer.java:2530)
        at org.antlr.runtime.CommonTokenStream.fillBuffer(CommonTokenStream.java
:119)
        at org.antlr.runtime.CommonTokenStream.LT(CommonTokenStream.java:238)
        at org.jf.smali.smaliParser.smali_file(smaliParser.java:430)
        at brut.androlib.mod.SmaliMod.assembleSmaliFile(SmaliMod.java:71)
        at brut.androlib.src.DexFileBuilder.addSmaliFile(DexFileBuilder.java:43)

        at brut.androlib.src.DexFileBuilder.addSmaliFile(DexFileBuilder.java:33)

        at brut.androlib.src.SmaliBuilder.buildFile(SmaliBuilder.java:64)
        at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:48)
        at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:35)
        at brut.androlib.Androlib.buildSourcesSmali(Androlib.java:222)
        at brut.androlib.Androlib.buildSources(Androlib.java:179)
        at brut.androlib.Androlib.build(Androlib.java:170)
        at brut.androlib.Androlib.build(Androlib.java:154)
        at brut.apktool.Main.cmdBuild(Main.java:174)
        at brut.apktool.Main.main(Main.java:59)
java.io.FileNotFoundException: ..\place-apk-here-for-modding\unsignedpoweramp.ap
k (The system cannot find the file specified)
        at java.util.zip.ZipFile.open(Native Method)
        at java.util.zip.ZipFile.<init>(Unknown Source)
        at java.util.jar.JarFile.<init>(Unknown Source)
        at java.util.jar.JarFile.<init>(Unknown Source)
        at com.android.signapk.SignApk.main(SignApk.java:437)
Could Not Find C:\Software\htc\Cracking\apk_manager_4.9\place-apk-here-for-moddi
ng\../place-apk-here-for-modding/unsignedpoweramp.apk

What version of the product are you using? On what operating system?
1.4.1

Please provide any additional information below.

Original issue reported on code.google.com by j...@eyrie.in on 28 Jun 2011 at 7:28

GoogleCodeExporter commented 9 years ago
The file used: Poweramp.apk
http://www.mediafire.com/?wd798zyiy24a69m

Original comment by j...@eyrie.in on 28 Jun 2011 at 7:29

GoogleCodeExporter commented 9 years ago
I have the same isue wutg version 1.4.1, building the Google+ app
http://www.mediafire.com/?fsh5wj0t0vo1kgf

macbookpro:Android mm$ apktool b -d out
I: Checking whether sources has changed...
I: Smaling...
W: Unknown file type, ignoring: out/smali/.DS_Store
W: Unknown file type, ignoring: out/smali/com/.DS_Store
W: Unknown file type, ignoring: out/smali/com/google/.DS_Store
Exception in thread "main" java.lang.NullPointerException
    at org.jf.util.PathUtil.getRelativeFile(PathUtil.java:44)
    at org.jf.smali.smaliFlexLexer.getSourceName(smaliFlexLexer.java:2569)
    at org.antlr.runtime.CommonTokenStream.getSourceName(CommonTokenStream.java:345)
    at org.antlr.runtime.Parser.getSourceName(Parser.java:88)
    at org.jf.smali.smaliParser.getErrorHeader(smaliParser.java:324)
    at org.antlr.runtime.BaseRecognizer.displayRecognitionError(BaseRecognizer.java:192)
    at org.antlr.runtime.BaseRecognizer.reportError(BaseRecognizer.java:186)
    at org.jf.smali.smaliParser.method(smaliParser.java:1620)
    at org.jf.smali.smaliParser.smali_file(smaliParser.java:561)
    at brut.androlib.mod.SmaliMod.assembleSmaliFile(SmaliMod.java:71)
    at brut.androlib.src.DexFileBuilder.addSmaliFile(DexFileBuilder.java:43)
    at brut.androlib.src.SmaliBuilder.buildFile(SmaliBuilder.java:101)
    at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:48)
    at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:35)
    at brut.androlib.Androlib.buildSourcesSmali(Androlib.java:222)
    at brut.androlib.Androlib.buildSources(Androlib.java:179)
    at brut.androlib.Androlib.build(Androlib.java:170)
    at brut.androlib.Androlib.build(Androlib.java:154)
    at brut.apktool.Main.cmdBuild(Main.java:174)
    at brut.apktool.Main.main(Main.java:59)

Original comment by mladen.m...@gmail.com on 5 Jul 2011 at 8:49

GoogleCodeExporter commented 9 years ago
same issue with all apk's created be App Inverter

Original comment by ad...@irexsoft.com on 21 Jul 2011 at 3:45

GoogleCodeExporter commented 9 years ago
same issue with all apk's created be App Invertor

Original comment by ad...@irexsoft.com on 21 Jul 2011 at 3:47

GoogleCodeExporter commented 9 years ago
I'm having the same problem on whatsapp.apk, trying to change some colors in 
the code.

Using apktool 1.4.1:

C:\Users\eitamd\Desktop\Clock>apktool b WhatsApp whatsblack.apk
I: Checking whether sources has changed...
I: Smaling...
Exception in thread "main" java.lang.NullPointerException
        at org.jf.util.PathUtil.getRelativeFile(PathUtil.java:44)
        at org.jf.smali.smaliFlexLexer.getSourceName(smaliFlexLexer.java:2569)
        at org.jf.smali.smaliFlexLexer.getErrorHeader(smaliFlexLexer.java:2661)
        at org.jf.smali.smaliFlexLexer.nextToken(smaliFlexLexer.java:2530)
        at org.antlr.runtime.CommonTokenStream.fillBuffer(CommonTokenStream.java
:119)
        at org.antlr.runtime.CommonTokenStream.LT(CommonTokenStream.java:238)
        at org.jf.smali.smaliParser.smali_file(smaliParser.java:430)
        at brut.androlib.mod.SmaliMod.assembleSmaliFile(SmaliMod.java:71)
        at brut.androlib.src.DexFileBuilder.addSmaliFile(DexFileBuilder.java:43)

        at brut.androlib.src.DexFileBuilder.addSmaliFile(DexFileBuilder.java:33)

        at brut.androlib.src.SmaliBuilder.buildFile(SmaliBuilder.java:64)
        at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:48)
        at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:35)
        at brut.androlib.Androlib.buildSourcesSmali(Androlib.java:222)
        at brut.androlib.Androlib.buildSources(Androlib.java:179)
        at brut.androlib.Androlib.build(Androlib.java:170)
        at brut.androlib.Androlib.build(Androlib.java:154)
        at brut.apktool.Main.cmdBuild(Main.java:174)
        at brut.apktool.Main.main(Main.java:59)

Original comment by eita...@gmail.com on 27 Oct 2011 at 9:50

GoogleCodeExporter commented 9 years ago
Issue 185 has been merged into this issue.

Original comment by Brut.alll on 5 Nov 2011 at 8:37

GoogleCodeExporter commented 9 years ago
Issue 214 has been merged into this issue.

Original comment by Brut.alll on 5 Nov 2011 at 8:38

GoogleCodeExporter commented 9 years ago
Getting same error editing SystemUI.apk

orkillakilla@ubuntu:~/android/apktool$ apktool b SystemUI
I: Checking whether sources has changed...
I: Smaling...
W: Unknown file type, ignoring: 
SystemUI/smali/com/android/systemui/R$drawable.smali~
Exception in thread "main" java.lang.NullPointerException
    at org.jf.util.PathUtil.getRelativeFile(PathUtil.java:44)
    at org.jf.smali.smaliFlexLexer.getSourceName(smaliFlexLexer.java:2922)
    at org.antlr.runtime.CommonTokenStream.getSourceName(CommonTokenStream.java:345)
    at org.antlr.runtime.Parser.getSourceName(Parser.java:88)
    at org.jf.smali.smaliParser.getErrorHeader(smaliParser.java:358)
    at org.antlr.runtime.BaseRecognizer.displayRecognitionError(BaseRecognizer.java:192)
    at org.antlr.runtime.BaseRecognizer.reportError(BaseRecognizer.java:186)
    at org.jf.smali.smaliParser.register_list(smaliParser.java:7162)
    at org.jf.smali.smaliParser.instruction(smaliParser.java:11369)
    at org.jf.smali.smaliParser.statements_and_directives(smaliParser.java:1841)
    at org.jf.smali.smaliParser.method(smaliParser.java:1609)
    at org.jf.smali.smaliParser.smali_file(smaliParser.java:595)
    at brut.androlib.mod.SmaliMod.assembleSmaliFile(SmaliMod.java:71)
    at brut.androlib.src.DexFileBuilder.addSmaliFile(DexFileBuilder.java:43)
    at brut.androlib.src.DexFileBuilder.addSmaliFile(DexFileBuilder.java:33)
    at brut.androlib.src.SmaliBuilder.buildFile(SmaliBuilder.java:64)
    at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:48)
    at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:35)
    at brut.androlib.Androlib.buildSourcesSmali(Androlib.java:222)
    at brut.androlib.Androlib.buildSources(Androlib.java:179)
    at brut.androlib.Androlib.build(Androlib.java:170)
    at brut.androlib.Androlib.build(Androlib.java:154)
    at brut.apktool.Main.cmdBuild(Main.java:182)
    at brut.apktool.Main.main(Main.java:67)

Original comment by orkillak...@gmail.com on 24 Dec 2011 at 7:29

GoogleCodeExporter commented 9 years ago
Getting same error editing ContactsProvider.apk
I: Smaling...
Exception in thread "main" java.lang.NullPointerException
    at org.jf.util.PathUtil.getRelativeFile(PathUtil.java:44)

Ubuntu 11.10

Original comment by kdebar...@gmail.com on 3 Jan 2012 at 8:03

GoogleCodeExporter commented 9 years ago
Here additional information.
On script running on Windows XP (under Virtual box).
java -jar "%~dp0\apktool.jar" if framework-res.apk
java -jar "%~dp0\apktool.jar" d -f framework-res.apk
java -jar "%~dp0\apktool.jar" d -f ContactsProvider.apk
java -jar "%~dp0\apktool.jar" b ContactsProvider ContactsProviderNew.apk

==> No error found.

on Ubuntu 11.10,
I have Exception in thread Main.

this two files are attached.

Original comment by kdebar...@gmail.com on 4 Jan 2012 at 11:30

Attachments:

GoogleCodeExporter commented 9 years ago
having the same error. windows 7

Original comment by ariciay...@gmail.com on 6 Jan 2012 at 1:19

GoogleCodeExporter commented 9 years ago
I could resolve the issue, by installing latest 1.6 JDK which is jdk1.6.0_30.
previous one was jdk1.6.0_16. 
maybe it might work for u too. 

Original comment by ariciay...@gmail.com on 11 Jan 2012 at 10:03

GoogleCodeExporter commented 9 years ago
I have been working on this for some time. I was using app to market (v. 2.6), 
but every time I tried to decompile an apk, it crashes. so now I'm using cmd 
and apktool. (I do make sure that apktool and adb.exe are in my path). I have 
no errors in decompiling, but with compiling I get this error:

Exception in thread "main" java.lang.NullPointerException? at 
org.jf.util.PathUtil?.getRelativeFile(PathUtil?.java:44) at 
org.jf.smali.smaliFlexLexer.getSourceName(smaliFlexLexer.java:2569) at 
org.jf.smali.smaliFlexLexer.getErrorHeader(smaliFlexLexer.java:2661) at 
org.jf.smali.smaliFlexLexer.nextToken(smaliFlexLexer.java:2530) at 
org.antlr.runtime.CommonTokenStream?.fillBuffer(CommonTokenStream?.java:119) at 
org.antlr.runtime.CommonTokenStream?.LT(CommonTokenStream?.java:238) at 
org.jf.smali.smaliParser.smali_file(smaliParser.java:430) at 
brut.androlib.mod.SmaliMod?.assembleSmaliFile(SmaliMod?.java:71) at 
brut.androlib.src.DexFileBuilder?.addSmaliFile(DexFileBuilder?.java:43) at 
brut.androlib.src.DexFileBuilder?.addSmaliFile(DexFileBuilder?.java:33) at 
brut.androlib.src.SmaliBuilder?.buildFile(SmaliBuilder?.java:64) at 
brut.androlib.src.SmaliBuilder?.build(SmaliBuilder?.java:48) at 
brut.androlib.src.SmaliBuilder?.build(SmaliBuilder?.java:35) at 
brut.androlib.Androlib.buildSourcesSmali(Androlib.java:222) at 
brut.androlib.Androlib.buildSources(Androlib.java:179) at 
brut.androlib.Androlib.build(Androlib.java:170) at 
brut.androlib.Androlib.build(Androlib.java:154) at 
brut.apktool.Main.cmdBuild(Main.java:174) at 
brut.apktool.Main.main(Main.java:59)

I am using Windows Vista 64 bit and my apk file is made with appinventor. I 
heard somewhere that apktool does not work with appinventor apps, but I am not 
yet completely convinced since I have also heard that appinventor apps should 
work fine with apktool. If this is the case please tell me. I have also heard 
that the problem is with my JDK. My JDK was indeed not updated, so I updated it 
to JDK7 update 3. I still get the same error. I also updated the Java JRE to 
the latest current version. I again get the same error. I don't know what to do 
next, so please tell me what I should do now. All I want to do is change the 
version code and the version name so that I can update two apps I have on the 
android play market. (If you want to check them out, just search "coen valk" 
and it will show you two apps: compare, an app that lets you compare two 
different products and tells you, and cooking with coen, a cooking app for 
kids, by kids. they are slightly buggy, that is why I want to update them. I 
already have the updated apk's finished, and those are the ones that I am 
changing the version name and version code of, since every time I try to upload 
the new apk's I get: "The new apk's versionCode (3) already exists.")

Original comment by clcjv...@gmail.com on 9 Jul 2012 at 10:11

GoogleCodeExporter commented 9 years ago
Fixed with v1.5.0 and new smali/baksmali.

Original comment by connor.tumbleson on 15 Nov 2012 at 3:15