1. 问题1
    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)
    原因很可能是多加了1个“;”
    .field final synthetic this$1:I;
    .field final synthetic this$1:I
  2. 问题2 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.literal(smaliParser.java:4954)
            at org.jf.smali.smaliParser.array_literal(smaliParser.java:5622)
            at org.jf.smali.smaliParser.literal(smaliParser.java:4895)
            at org.jf.smali.smaliParser.annotation_element(smaliParser.java:5740)
            at org.jf.smali.smaliParser.annotation(smaliParser.java:5893)
            at org.jf.smali.smaliParser.smali_file(smaliParser.java:619)
            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)
    原因很可能是有些位置没有对齐
    .line 195之前本来是4空格,却不小心弄成3空格
    或者又是多加了1“,”
    value = {
        Loms/cj/ads/R$string;,
    }
    value = {
        Loms/cj/ads/R$string;
    }

总之,看见“Exception in thread "main" java.lang.NullPointerException at org.jf.util.PathUtil.getRelativeFile(PathUtil.java:44) ”,多半是smali文件语法有问题。

 

另外1个有意思的错是,AndroidlibException,和p0有关!

作为object的p0有时会是16bit,而作为register来call method的object必须是32bit,解决这个问题的方法是:move-object/from16 v0, p0,然后用v0来call method

Exception in thread "main" brut.androlib.AndrolibException: Could not smali file: java.io.FileInputStream@13b5a3a
        at brut.androlib.src.DexFileBuilder.addSmaliFile(DexFileBuilder.java:45)
        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)

tip:

  1. 如何得到calling stack?
    加个除法错,就能得到。
Advertisements