Converting the .apk into readable java file

Saying truly, i am very new to android. and i have just completed my first app. during the development i found very helpful blog that are really useful to solve the problem that are encounter during the project development. so first of all i want thank all u respected blog writer. And i hope you will continue, as it is encourages for the new comer.

In my very first blog i want to write something about converting .apk to readable java files because it might be very helpful for any new comer to understand structure and coding style in android. and also i believe Learning by example is one of the best method for learning new thing initially.
HERE ARE THE STEPS
(assumption my.apk is in my home folder)
1.First step is to extract the “classes.dex” file from the APK:

   command :$ unzip program.apk classes.dex
		Archive:  program.apk
  		inflating: classes.dex

2.Now, we use the tool dex2jar to convert the classes.dex file to Java .class files:
here is the Link for dex2jar :http://code.google.com/p/dex2jar/
download it and unzip in home, as my .apk in home then run the command

$ bash dex2jar/dex2jar.sh ./classes.dex
	version:0.0.7.8-SNAPSHOT
	2 [main] INFO pxb.android.dex2jar.v3.Main - dex2jar ./classes.dex -> 	./classes.dex.dex2jar.jar
	Done.

Above command convert .dex file in to .jar file so we can us jd-gui to open the file

3. From here we obtain the file “classes.dex.dex2jar.jar”, now we can use the java decompiler JD-GUI to extract the source code:
link for jd-gui http://java.decompiler.free.fr/?q=jdgui

command $ ./jd-gui classes.dex.dex2jar.jar

this command opens the jd-gui then you can navigate to classes.dex.dex2jar.jar(File then save as ur desired name. Which contain java file in readable format.

About these ads

3 thoughts on “Converting the .apk into readable java file

  1. I really doubt people out there decompiling APKs are doing it to learn structure and coding style. Most likely they are swiping code outright because they are too lazy or incompetent to code it themselves.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s