How to convert .apk files to java

73,705

Solution 1

The extension Google uses for Android Applications (APK) may seem a bit complicated at first, but it really isn’t. In fact, an .apk is nothing else than a .zip file disguised as an .apk. That’s dumbing it down, but you get it. Essentially, if one wanted to see what’s inside an app, they would just change the extension of application-name.apk to application-name.zip, unzip it. And there you have it: The contents of the .apk! We aren’t done yet, read more after the break. Here is where it gets tricky. Inside the folder where you unzipped the contents of the application, you’ll find a file named classes.dex. That’s the most important file of the whole application, containing all the java files, but it’s encrypted! No worries, that can easily be solved. You’ll need two things:

  1. Dex2Jar from http://code.google.com/p/dex2jar/
  2. A regular Java decompiler, such as JD from http://java.decompiler.free.fr

Copy classes.dex to the folder where you unzipped Dex2Jar, and run from the command line: “dex2jar.bat classes.dex” This will produce a file, strangely named something like: “classes.dex.dex2jar.jar” If you have WinRAR installed, you can just unpack the files. If you don’t, install it. Now go ahead and adjust it to your liking!

Solution 2

its easy just follow the below 4 steps :

1) Unzip your .apk to the folder and get the classes.dex file.

2)Place this classes.dex file inside dex2jar(you should download this) and execute ./dex2jar.sh classes.dex in the terminal.

3)It will create classes.dex.dex2jar.jar,place it inside jd-gui(you should download this).

4)Execute ./jd-gui classes.dex.dex2jar.jar---will generate the .java files.

Share:
73,705
user555910
Author by

user555910

Updated on May 31, 2020

Comments

  • user555910
    user555910 almost 4 years

    How to convert .apk files to java in android.