[TOOL]APK to Java RC2 *UPDATE*

Search This thread

Senzune

Member
Jun 16, 2011
36
3
Can the Java code be run in an application, browser perhaps? As in, running the app on your computer?
 

WolfKaBaL

Member
Nov 13, 2007
24
2
Description:
Since I'm into making Android Apps nowadays, I thought of making this tool to save me (and you) time. So I started coding it and it worked out pretty well so far. The tool can decompiles your selected apk to Java code, to learn from it, so as an educational purpose.
Additionally it also can decompile to smali code and it can decompile the resources of the app. It's currently a very early beta but it works successfully (at least at my computer)

Not to take anything away from the work you've done. But just so other's aren't confused, this is just an automated script/GUI for existing tools. It simply runs dex2jar, apktool, baksmali, etc.. I came into this hoping it was maybe a different decompiler, a better one that might do a better job of de-obfuscating the code. But seeing that it's just an automater/GUI takes away from that.

Great job on the automater though, and keep up the work towards your education. We all have to start somewhere. :good:
 

trter10

Senior Member
Jan 25, 2012
674
464
This looks amazing!

I'm having an error though,

xlTy.png


Thanks!
 

sUsH667

Senior Member
Jul 1, 2011
500
439
first: thx for your great effort and work!
one question though: so this does not produce usable and compilable java-code, right? so we can not use this tool to decompile for example a SystemUI.apk, apply our mod to the produced java-code and then recompile it to a working SystemUI.apk?

greetz n thx,

sUsH
 
  • Like
Reactions: broodplank1337

SinisterChedda

Senior Member
Feb 4, 2011
543
173
Albuquerque, NM
Im new to thread. I've used dex2jar years ago for help with my java II class making android apps for school. So does this just use dex2jar and some other tools to decompile with a GUI. Does this let you put it in eclipse and recompile?

sent from my now EXTINCT cm10 Disarmed Toaster-.2 Evo 3D via xda app for Android
 

broodplank1337

Inactive Recognized Developer
Nov 24, 2011
4,992
10,155
Nijmegen
www.broodplank.net
Does it have linux support? If not I can always try VM.

Unfortunately not, Maybe I will make a new version for linux also :) (I think all the external programs also so support linux)


Can the Java code be run in an application, browser perhaps? As in, running the app on your computer?

No, this is no javascript, but java. You can run it in Eclipse for example


Not to take anything away from the work you've done. But just so other's aren't confused, this is just an automated script/GUI for existing tools. It simply runs dex2jar, apktool, baksmali, etc.. I came into this hoping it was maybe a different decompiler, a better one that might do a better job of de-obfuscating the code. But seeing that it's just an automater/GUI takes away from that.

Great job on the automater though, and keep up the work towards your education. We all have to start somewhere. :good:

Yes that's what it does, I also mentioned the external tools used etc, so I think it's already clear that I didn't create an actual APK to Java decompiler, which would take me my whole life to only make a beta version :')

I used the most accurate tools, to bad JD-Core isn't available, really hate to work with a unnecessary gui which is also not fully controllable for some reason.



This looks amazing!

I'm having an error though,

xlTy.png


Thanks!

Thanks, In the current git commit (Early RC1) this problem is fixed. (Some one else mentioned it also, but It's kind of strange I think because I never received any error like that. however, it's fixed now.. (in the commit at least)
Will release RC1 probably today


first: thx for your great effort and work!
one question though: so this does not produce usable and compilable java-code, right? so we can not use this tool to decompile for example a SystemUI.apk, apply our mod to the produced java-code and then recompile it to a working SystemUI.apk?

greetz n thx,

sUsH


You're welcome!, Well actually, It does generate a usable code, but it needs to be edited a little in most cases, I think all apks that are specially built for specific devices such as SystemUI.apk won't work without modifying some code.
for example, when you want to port a function from an other SystemUI.apk just decompile it, look up the source and paste it in your SystemUI.apk, probably it will have some errors because of invalid variable names or such, but the actually code just keeps intact, so that's the most important thing.


wow. I'm impressed bro. Good job.

Thanks, Hope you like the tool^^


Im new to thread. I've used dex2jar years ago for help with my java II class making android apps for school. So does this just use dex2jar and some other tools to decompile with a GUI. Does this let you put it in eclipse and recompile?

sent from my now EXTINCT cm10 Disarmed Toaster-.2 Evo 3D via xda app for Android

Basically it's an automated gui for several external tools yes, I'm still working on the Eclipse function to make the output less buggy, I think making an actual working eclipse project from an apk is the biggest challenge, But remember this is only a beta, so many new versions will release ;)

Looks amazing, this will really come in handy!

Thanks! It can become very handy sometimes idd :D
 

SinisterChedda

Senior Member
Feb 4, 2011
543
173
Albuquerque, NM
Basically it's an automated gui for several external tools yes, I'm still working on the Eclipse function to make the output less buggy, I think making an actual working eclipse project from an apk is the biggest challenge, But remember this is only a beta, so many new versions will release ;)
:D

Nothing wrong with GUI. Great job. About the eclipse portion of recompiling from source would be an elite defeat. I don't even think it can be done but with programming anything can happen. Downloaded now to check out. Just wondering if you can decompile jelly bean sys apps? Xda app sucks at search function.

sent from my now EXTINCT cm10 Disarmed Toaster-.2 Evo 3D via xda app for Android
 

exadeci

Senior Member
Jul 21, 2010
855
316
Sydney
I would love to be able to try it but I get an error
I'm on windows 8 x64
I tried RC1 couldn't compile (error adding splash) but I ran it instead and same error
 

Attachments

  • error.PNG
    error.PNG
    7 KB · Views: 240
Last edited:

broodplank1337

Inactive Recognized Developer
Nov 24, 2011
4,992
10,155
Nijmegen
www.broodplank.net
Nothing wrong with GUI. Great job. About the eclipse portion of recompiling from source would be an elite defeat. I don't even think it can be done but with programming anything can happen. Downloaded now to check out. Just wondering if you can decompile jelly bean sys apps? Xda app sucks at search function.

sent from my now EXTINCT cm10 Disarmed Toaster-.2 Evo 3D via xda app for Android

Yes the eclipse thing is the biggest part, It does create an importable eclipse project but when there's a lot of code it always has errors, I used it to port some small apps :) worked without any problems.

And yes you can decompile JB system apps! you're interested in porting functions from JB to ICS?

And the search function is okay, but only if you use "Search in titles only". else it's rubbish


I would love to be able to try it but I get an error
I'm on windows 8 x64
I tried RC1 couldn't compile (error adding splash) but I ran it instead and same error

I've identified that problem, It's either your apk doesn't have any source code (like framework-res.apk) or it's because the Heapsize set by java is to large for your system, I've indicated 2gb ram as minimal requirement. but the strange thing is that I have 8gb ram and still it gave me that error (at a very early build). So I edited the heapsize (https://github.com/broodplank/APKtoJava/commit/45dcbd5a956416883ee9c0e7a06300073ed4f1ca) to fix the problem. It seems you probably need a heapsize even lower then 512mb! try it, in RC1 final you will have the option to set the heapsize trough preferences menu btw.


Which Java version do you have? Also try making java /bin folder as a environmental variable. I'm a little buzzed so hopefully it applies.


sent from my now EXTINCT cm10 Disarmed Toaster-.2 Evo 3D via xda app for Android

I think that's not the problem, I already found out the reason 2 days ago. check the post above for explanation.
 
  • Like
Reactions: SinisterChedda

exadeci

Senior Member
Jul 21, 2010
855
316
Sydney
I'm running java 7 update 7, also I fixed my compile error by setting an env:
Code:
EnvSet("path", EnvGet("path") & ";" & @ScriptDir) 
;Include splash image in exe
FileInstall("splash.jpg", @TempDir & "\splash.jpg", 1)
This way you can remove your absolute path and remove all the @ScriptDir & "\ from your script

[edit] I will try changing it but I have 8GB
I tried adding path to java jdk and Java_home but doesn't seems to work, I'm doing my test with cyanogenmod 10 deskclock.apk
There is nothing in preferences except 2 empty squares, so I guess it's all related to a java issue
 
Last edited:
  • Like
Reactions: broodplank1337
S

snowman77

Guest
Thanks . What are requirements of this? Is a certain version of windows need?

Thank you for this work
 
Last edited:

broodplank1337

Inactive Recognized Developer
Nov 24, 2011
4,992
10,155
Nijmegen
www.broodplank.net
I'm running java 7 update 7, also I fixed my compile error by setting an env:
Code:
EnvSet("path", EnvGet("path") & ";" & @ScriptDir) 
;Include splash image in exe
FileInstall("splash.jpg", @TempDir & "\splash.jpg", 1)
This way you can remove your absolute path and remove all the @ScriptDir & "\ from your script

[edit] I will try changing it but I have 8GB
I tried adding path to java jdk and Java_home but doesn't seems to work, I'm doing my test with cyanogenmod 10 deskclock.apk
There is nothing in preferences except 2 empty squares, so I guess it's all related to a java issue

Thanks! I didn't know that command! I will update the source with EnvSet, I chose for the relative path since Fileinstall needs a relative path, but this way is much better :)

And the preferences screen is still empty idd, still need to fill it ^^ easy job tho, the commented part is al I need, just some changing and it's done


Thanks . What are requirements of this? Is a certain version of windows need?

Thank you for this work

Will you or anyone mind if I rewrite it in C

You're welcome, the minimal requirements are currently aimed at: (from helpfile)

- Windows XP / 7 (32 bit or 64bit)
- 2GB RAM
- Java Runtime Environment 6 or 7 (or JDK 6 / 7 )

And you could rewrite it in C, but how do you want to release it? since it already exists now. with the same name and functionality? please explain.
 

hypnos17

Senior Member
Jun 18, 2012
3,049
4,522
Pan Daemonium
Hey brood...does it work on Linux?
P.s....it's a great tool, why (if u didn't already done it) don't u post it in general section, too?
Sorry for bad english :)
 

broodplank1337

Inactive Recognized Developer
Nov 24, 2011
4,992
10,155
Nijmegen
www.broodplank.net

vulcanfk

Member
Mar 22, 2011
36
4
No, exe's don't run on linux (you could try with wine, but no success guaranteed), I will try to make a linux version if im able to. ^^

Thanks, and I did post it in Android Software Development ;)

http://xdaforums.com/showthread.php?t=1911084

Looks like a great tool; thanks brood! Unfortunately, I don't have any Windows boxes so I second (third, fourth) the vote for a Linux version. I'd be willing to help contribute if you need some assistance with the conversion.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 199
    APK to Java Release Candidate 2


    Review by Adam from XDA-TV:
    YouTube Video
    The fragment about APK to Java
    Article on the XDA Frontpage

    apktojava-header-milestone.png


    Description:
    Since I'm into making Android Apps nowadays, I thought of making this tool to save me (and you) time. So I started coding it and it worked out pretty well so far. The tool can decompiles your selected apk to Java code, to learn from it, so as an educational purpose.
    Additionally it also can decompile to smali code and it can decompile the resources of the app. It's currently a very early beta but it works successfully (at least at my computer)
    The final version should convert any app successfully to java/smali/resource and an eclipse project, I'm doing my best to make it all work ASAP, if you think I did something wrong in the source or you want to contribute anything please let me know!

    Used External Tools (thanks a lot to these developers!):
    - 7za (Igor Pavlov)
    - apktool (Ryszard Wisniewski, iBotPeaches)
    - aapt (Google AOSP Team)
    - baksmali-1.4.0 (JesusFreke's)
    - jd-gui (Emmanuel Dupuy)
    - jad (Pavel Kouznetsov)
    - dex2jar (pxb1988)

    Requirements:
    - JRE 6/7 (I think that's all, but maybe android-sdk is needed, I guess not)


    Screenshot:
    rc2screen.png




    Download:
    Version RC2 (check github for changelog):
    Mirror #1: broodplank.net
    Mirror #2: Mediafire.com

    Version RC1 (check github for changelog):
    Mirror #1: broodplank.net
    Mirror #2: Mediafire.com

    Version 0.9 beta (check github for changelog):
    Mirror #1: broodplank.net
    Mirror #2: Mediafire.com

    Version 0.8 beta (check github for changelog):
    Mirror #1: broodplank.net
    Mirror #2: Mediafire.com

    Version 0.7 beta (check github for changelog):
    Mirror #1: broodplank.net
    Mirror #2: Mediafire.com

    Version 0.6 beta (check github for changelog):
    Mirror #1: broodplank.net
    Mirror #2: Mediafire.com

    Version 0.5 beta:
    Mirror #1: broodplank.net
    Mirror #2: Mediafire.com

    Github Sources:
    https://github.com/broodplank/APKtoJava


    Please let me know how it runs!
    5
    really great, thanks :laugh:

    you should get a recognized contributor and developer, since you develop so many useful programs for us :good:


    :good::good::good:i don't have enought words to thank you.... this app it's amazing. THANKS a lot !!! GOOD LUCK !!! :good::good::good:

    Haha, you're welcome! I hope you enjoy it :D



    really great, thanks :laugh:

    you should get a recognized contributor and developer, since you develop so many useful programs for us :good:

    You're welcome ^^. And I might get Recognized Developer later, the moment when I received the Recognized Contributor title, the Recognized Developer title was closed for a few months (and still is). So maybe after that time I can get an upgrade :D
    4
    Hi Brood,

    Great tool...can you please make SGS3 launcher compatible to GB with this tool?

    thanks

    You might be able to if you do a hell lot of porting and have loads of java knowledge, you can't just do it with this tool, that would be just to easy..

    btw,

    RC2 Pre-Release Commit

    "Added an alternative way of making the java code (JAD), All options are
    now working. Finally able to control JD-GUI completely. updated help
    file and splash."

    https://github.com/broodplank/APKtoJava/commit/a6c6e80bfb68e0bc5bd6233b173cdd0cfa5ddc49

    it's a Pre-Release, but it's finally becoming something :D
    3
    Awesome, i realy want to learn more about android..
    Thanks Brood!

    Thanks :), You've come to the right place for learning more about android :D and you're welcome ^^
    3
    Does it have linux support? If not I can always try VM.

    Unfortunately not, Maybe I will make a new version for linux also :) (I think all the external programs also so support linux)


    Can the Java code be run in an application, browser perhaps? As in, running the app on your computer?

    No, this is no javascript, but java. You can run it in Eclipse for example


    Not to take anything away from the work you've done. But just so other's aren't confused, this is just an automated script/GUI for existing tools. It simply runs dex2jar, apktool, baksmali, etc.. I came into this hoping it was maybe a different decompiler, a better one that might do a better job of de-obfuscating the code. But seeing that it's just an automater/GUI takes away from that.

    Great job on the automater though, and keep up the work towards your education. We all have to start somewhere. :good:

    Yes that's what it does, I also mentioned the external tools used etc, so I think it's already clear that I didn't create an actual APK to Java decompiler, which would take me my whole life to only make a beta version :')

    I used the most accurate tools, to bad JD-Core isn't available, really hate to work with a unnecessary gui which is also not fully controllable for some reason.



    This looks amazing!

    I'm having an error though,

    xlTy.png


    Thanks!

    Thanks, In the current git commit (Early RC1) this problem is fixed. (Some one else mentioned it also, but It's kind of strange I think because I never received any error like that. however, it's fixed now.. (in the commit at least)
    Will release RC1 probably today


    first: thx for your great effort and work!
    one question though: so this does not produce usable and compilable java-code, right? so we can not use this tool to decompile for example a SystemUI.apk, apply our mod to the produced java-code and then recompile it to a working SystemUI.apk?

    greetz n thx,

    sUsH


    You're welcome!, Well actually, It does generate a usable code, but it needs to be edited a little in most cases, I think all apks that are specially built for specific devices such as SystemUI.apk won't work without modifying some code.
    for example, when you want to port a function from an other SystemUI.apk just decompile it, look up the source and paste it in your SystemUI.apk, probably it will have some errors because of invalid variable names or such, but the actually code just keeps intact, so that's the most important thing.


    wow. I'm impressed bro. Good job.

    Thanks, Hope you like the tool^^


    Im new to thread. I've used dex2jar years ago for help with my java II class making android apps for school. So does this just use dex2jar and some other tools to decompile with a GUI. Does this let you put it in eclipse and recompile?

    sent from my now EXTINCT cm10 Disarmed Toaster-.2 Evo 3D via xda app for Android

    Basically it's an automated gui for several external tools yes, I'm still working on the Eclipse function to make the output less buggy, I think making an actual working eclipse project from an apk is the biggest challenge, But remember this is only a beta, so many new versions will release ;)

    Looks amazing, this will really come in handy!

    Thanks! It can become very handy sometimes idd :D