ThisIsLibra / AndroidProjectCreator

Convert an APK to an Android Studio Project using multiple open-source decompilers

Home Page:https://maxkersten.nl/projects/androidprojectcreator/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JADX decompilation using DEX2JAR

soucevi1 opened this issue · comments

Hi, you did a good job on this project, I really like to use it.
I noticed one small thing -- when you run the program with -decompile JADX, you can see the following in the output:

...

[+]Decompling JAR with DEX2JAR
dex2jar /opt/AndroidProjectCreator/target/library/temp/8a9550a5-7498-4d34-a1d8-86375119c668/apktool/classes.dex -> /opt/AndroidProjectCreator/target/library/temp/8a9550a5-7498-4d34-a1d8-86375119c668/output.jar

[+]Decompilation finished
[+]Decompling JAR with JADX
INFO  - loading ...
INFO  - processing ...

...

But JADX is a DEX -> Java decompiler and it does not need a JAR. In fact, when you give JADX a JAR file, JADX will convert it to DEX first:

$ jadx -d $(pwd) $(pwd)/classes-dex2jar.jar
INFO  - loading ...
INFO  - converting to dex: classes-dex2jar.jar ...

...

AndroidProjectCreator works well even now, going DEX -> JAR -> (DEX) -> Java, and this issue has a low severity. But if it decompiled to Java straight from DEX, it might save some execution time. Also, the results might be a little more accurate, as I can imagine that the DEX -> JAR -> DEX conversion can lead to some kind of loss of information or precision, especially with obfuscated APKs.

Hello soucevi1, great to hear you like the tool! Thank you for the compliment :)

As for your suggestion, I think it is a really good one. The conversion of of the classes.dex file to the JAR file is indeed causing some unwanted noise in the decompiled output. I will see if I can find some time sometime soon to ensure that the decompilation is done directly, as it sounds perfectly doable.

Cheers, and let me know if you have other suggestions, or feedback in general!

I just realized one more thing -- apart from DEX files, JADX also accepts whole APKs and decompiles all classes files it finds within. This might solve the multiple DEX support someone was asking for in #15. It would be only solved for -decompile JADX though, so not really a complete solution, but it might help.

I do have a different solution for the multi-dex support in mind, but I like the way your helping with the project. Im currently finishing some other research I'm working on. After that, I'll make some time for APC to resolve this issue, and hopefully introduce a new feature I have in mind. If you find any other bugs, please do make issues for them!

Just pushed version 1.5-stable that contains a fix for this issue. Thank you for reporting it!