Hi! 🙂 Here another way of decompiling an android apk file. This method does not directly decompile the source. First uses the tool “Dex2jar” to convert the classes.dex file in to a compressed jar file containing the .class files . Later the “jd-gui” decompiler can be used to decompile the jar file content to the original source. Following figure shows the process of compiling android source into an apk and the reverse engineering flow.
Convert the dex file to a jar with “dex2jar”
- Download the latest “dex2jar” from –> (https://sourceforge.net/projects/dex2jar/files)
- Unzip the file . The d2j-dex2jar.sh file in the dex2jar-2.0 diectory is used to generate the jar file.
- Make the .d2j-invoke.sh file executable. Otherwise you will get permission denied message.
Command $ sudo chmod +x d2j-invoke.sh
- Goto the dex2-jar foler –>Execute the following command to generate the jar file. This will create something like classes-dex.jar
This is the classes.dex file that I am using in the example.
Command $ sh d2j-dex2jar.sh <path to classes.dex file>
you can simply drag and drop the classes.dex file to the terminal so that it will take the path automatically.
- The resulted classes-dex2jar.jar file will be generated in the same location.
You can unzip the jar file and see that it contains .class files
Decompile the original source with “JD-GUI” decompiler
- Download the “jd-gui” for linux from -> (http://jd.benow.ca/)
- Unzip the file and you will see “jd-gui” executable file.
- If you are having 64 bit Ubuntu 14.0 then install following libs
Command $ sudo apt-get install libgtk2.0-0:i386 libxxf86vm1:i386 libsm6:i386 lib32stdc++6
- Now run the “jd-gui”. It will open the decompiler
- Open the generated classes-dex2jar.jar file from the decompiler. You will be able to view the original source from this.
Cheers ! 🙂
Have how to recompile this app after modify your code? On Eclipse, for example?
Pingback: Is GOI's National Informatics Centre also culpable for Abhinav Srivastav's Aadhaar data hack incident? - Alt News
Pingback: Is GOI’s National Informatics Centre also culpable for Abhinav Srivastav’s #Aadhaar data hack incident? | Kractivism
Pingback: Investigation: How Abhinav Srivastav Was Able To Hack Aadhaar Database | GGI News