使用apktool做build时,有这么1个错。  花了半天时间,才找到原因。

android/app/Activity写成android.app.Activity了。

同学,要晓得smali和java在这点上,语法是不同的哇。

$ apktool.bat b draw_and_ride_lite draw_and_ride_lite.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:2922)
        at org.jf.smali.smaliFlexLexer.getErrorHeader(smaliFlexLexer.java:3014)
        at org.jf.smali.smaliFlexLexer.nextToken(smaliFlexLexer.java:2883)
        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:464)
        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)

 

几点tips:

  1. smali function must write a return clause
    either return-void,or return,or return-object
  2. smali function must declare its variables, whether its number is 0 or not
    .locals 0
Advertisements