alexzaitsev / apk-dependency-graph

Android class dependency visualizer. This tool helps to visualize the current state of the project.
Apache License 2.0
755 stars 70 forks source link

NullPointerException in the analysis step #3

Closed cosic closed 8 years ago

cosic commented 8 years ago

I try to use java -jar apk_dependency_graph_0.0.2.jar -i path-to-folder-with-decompiled-files -o analyzed.js -f com.example.test and I get:

    Exception in thread "main" java.lang.NullPointerException
        at code.CodeUtils.isClassInner(CodeUtils.java:14)
        at code.SmaliAnalyzer.processSmaliFile(SmaliAnalyzer.java:99)
        at code.SmaliAnalyzer.traverseSmaliCode(SmaliAnalyzer.java:58)
        at code.SmaliAnalyzer.traverseSmaliCode(SmaliAnalyzer.java:61)
        at code.SmaliAnalyzer.run(SmaliAnalyzer.java:32)
        at code.Main.main(Main.java:20)

If I use the nofilter flag I get:

    Exception in thread "main" java.lang.NullPointerException
        at code.SmaliAnalyzer.isClassOk(SmaliAnalyzer.java:132)
        at code.SmaliAnalyzer.processSmaliFile(SmaliAnalyzer.java:91)
        at code.SmaliAnalyzer.traverseSmaliCode(SmaliAnalyzer.java:58)
        at code.SmaliAnalyzer.traverseSmaliCode(SmaliAnalyzer.java:61)
        at code.SmaliAnalyzer.traverseSmaliCode(SmaliAnalyzer.java:61)
        at code.SmaliAnalyzer.traverseSmaliCode(SmaliAnalyzer.java:61)
        at code.SmaliAnalyzer.traverseSmaliCode(SmaliAnalyzer.java:61)
        at code.SmaliAnalyzer.run(SmaliAnalyzer.java:32)
        at code.Main.main(Main.java:20)
alexzaitsev commented 8 years ago

Seems that apktools has some issues and cannot decompile every apk. I have one hint: not to use apks with Instant Run. It cannot be decompiled in usual way. If you don't use Instant Run could you find out the problematic file changing the sources and running the program? You just should add log to this method private void processSmaliFile(File file) to see what file is processing right now. After that please attach it here so I'll be able to investigate further.

I'll release a new version today where i'll wrap all sentive code into try-catch blocks but we should rich the source of the problem to really resolve it.

Thank you.

alexzaitsev commented 8 years ago

Upd: please try to run v. 0.0.3: https://github.com/alexzaitsev/apk-dependency-graph/releases/tag/0.0.3

cosic commented 8 years ago

@alexzaitsev Yep, v. 0.0.3 works as well!