FORUMS
Remove All Ads from XDA

[Shell Script]GetJava (get java code from apks instantly)

4,992 posts
Thanks Meter: 10,205
 
By broodplank1337, Inactive Recognized Developer on 11th December 2013, 01:17 AM
Post Reply Email Thread
19th December 2013, 09:41 PM |#11  
elesbb's Avatar
Senior Member
Thanks Meter: 5,326
 
Donate to Me
More
Quote:
Originally Posted by broodplank1337

Well if you read the OP you will see that it does more then just convert the dex to a jar file. sine thats the only thing dex2jar can do

I wrote this small shell script that basically extracts classes.dex from an apk/jar, then decompiles the classes.dex to jar classes, extracts the classes and converts them to java code.

-.- yes i get that. Thats obvious from the thread title.. but you can use JDGui or other tools to get the java source from the jar files.. In terms of conversion, how is this different from dex2jar?
 
 
20th December 2013, 12:40 AM |#12  
broodplank1337's Avatar
OP Inactive Recognized Developer
Flag Nijmegen
Thanks Meter: 10,205
 
Donate to Me
More
Quote:
Originally Posted by elesbb

-.- yes i get that. Thats obvious from the thread title.. but you can use JDGui or other tools to get the java source from the jar files.. In terms of conversion, how is this different from dex2jar?

well. JAD and JDgui (which I use in ApktoJava) are class to java decompilers, but dex2jar converts the dalvik byte code (classes.dex) to java classes. so they are very different, also dex2jar always does it's job correctly all the time, while java decompiler tend to fail now and then (to give you a reasonably readable code)
The Following User Says Thank You to broodplank1337 For This Useful Post: [ View ] Gift broodplank1337 Ad-Free
20th December 2013, 09:15 AM |#13  
Devarishi's Avatar
Member
Flag Imphal
Thanks Meter: 6
 
Donate to Me
More
This will be useful for those beginners for who wants to learn java for android especially like me. Amazing thumps
21st December 2013, 03:58 PM |#14  
arpitkh96's Avatar
Senior Member
Flag panipat
Thanks Meter: 646
 
Donate to Me
More
Quote:
Originally Posted by broodplank1337

well. JAD and JDgui (which I use in ApktoJava) are class to java decompilers, but dex2jar converts the dalvik byte code (classes.dex) to java classes. so they are very different, also dex2jar always does it's job correctly all the time, while java decompiler tend to fail now and then (to give you a reasonably readable code)

If i use your script to decompile(dex2jar) systemui.apk.would i able to recompile it

Sent from my GT-S5570 using XDA Premium 4 mobile app
21st December 2013, 07:11 PM |#15  
broodplank1337's Avatar
OP Inactive Recognized Developer
Flag Nijmegen
Thanks Meter: 10,205
 
Donate to Me
More
Quote:
Originally Posted by arpitkh96

If i use your script to decompile(dex2jar) systemui.apk.would i able to recompile it

Sent from my GT-S5570 using XDA Premium 4 mobile app

I think not, it contains pretty much code and next to that it needs the android environment to be compiled. almost all system apks cannot be recompiled unfortunately
22nd December 2013, 04:11 AM |#16  
arpitkh96's Avatar
Senior Member
Flag panipat
Thanks Meter: 646
 
Donate to Me
More
Quote:
Originally Posted by broodplank1337

I think not, it contains pretty much code and next to that it needs the android environment to be compiled. almost all system apks cannot be recompiled unfortunately

Ok.(i have android environment)

Sent from my GT-S5570 using XDA Premium 4 mobile app
23rd December 2013, 03:53 AM |#17  
Recognized Developer
Thanks Meter: 2,091
 
Donate to Me
More
One thing that dex2jar has a hard time with is switch/case statements, and big if/then/else ladders. When compiling down to dalvik code, these often get broken out to seemingly random parts of the function with just an if-eqz :labelname and a return statement. This often means that the code for the case statement shows up outside of the switch statement when converted back to .class files.

TLDR: No, most of the time the resulting java code will not recompile without some tweaking.
The Following User Says Thank You to Fenny For This Useful Post: [ View ]
25th December 2013, 09:09 PM |#18  
elesbb's Avatar
Senior Member
Thanks Meter: 5,326
 
Donate to Me
More
Quote:
Originally Posted by Fenny

One thing that dex2jar has a hard time with is switch/case statements, and big if/then/else ladders. When compiling down to dalvik code, these often get broken out to seemingly random parts of the function with just an if-eqz :labelname and a return statement. This often means that the code for the case statement shows up outside of the switch statement when converted back to .class files.

TLDR: No, most of the time the resulting java code will not recompile without some tweaking.

Its impossible to recompile any java decompiled apk due to resource ids.


Im wondering if this scrip will return the //Internal error// in a lot of apps when decompiling.
The Following User Says Thank You to elesbb For This Useful Post: [ View ] Gift elesbb Ad-Free
21st December 2017, 07:11 PM |#19  
Junior Member
Thanks Meter: 0
 
More
Not the best way to recover your lost work. Tried it on an APK I have written 2 years ago and I can barely recognize my code. Better than nothing I guess, thanks.
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes