You are on page 1of 6

11/24/13

How to Decompile Apk To Source - Mobile QA Zone

W elcom e t o Mobile QA Zon e

Search Mobile QA Zone

Search

Sign Up Sign In

Mobile QA Zone A Mobile Application Testing Community Home My Page Community Mobile Testing Tools Mobile App Testing We Recommend About Us All Blog Posts My Blog Add

How to Decompile Apk To Source


Posted by vignesh on June 25, 2013 at 3:30pm View Blog Several times while testing with robotium we face the issues(since we have only apk and not code), So inorder to overcome it i used to decompile the application(apk) , Ok follow these steps You will need1. 2. 3. 4. Eclipse IDE Java Runtime (of course) JD-GUI or JD Eclipse plugin DexToJar (get them from here: http://code.google.com/p/dex2jar/)

And now follow the steps Step 1: Create a java project, name it DexToJava.

www.mobileqazone.com/profiles/blogs/how-to-decompile-apk-to-source

1/6

11/24/13

How to Decompile Apk To Source - Mobile QA Zone

Step 2: Create a folder and name it libs. Paste all jars file in the libs folder after extracting dex2jar-0.0.9.8.tar.gz . Go to build path. Add all the jars in the build path.

Step 3: You are almost done. Get an apk file and paste it in your project. For me it is facebook.apk.

Step 4: right click on project and select run as. Set main class: com.googlecode.dex2jar.v3.Main

www.mobileqazone.com/profiles/blogs/how-to-decompile-apk-to-source

2/6

11/24/13

How to Decompile Apk To Source - Mobile QA Zone

Step 5: Set Argument facebook.apk and now click on apply and run it.

Step 6: after completing the job, you will find on console:

Step 7: now refresh the project, and you will find facebook_dex2jar.jar. And you know already how to get java source from jar. Use JD-GUI. Note : this method wont work if code is obfuscated with third party like proguard ,i will share that method in detail later AND if you feel its too large to do , for u some shareware tools like Androchef will do for u Linux : before this download dex2jar ,and jdgui for your gnome/kde editions (assumption my.apk is in my home folder) 1.First step is to extract the classes.dex file from the APK: 1c o m m a n d: $u n z i pp r o g r a m . a p kc l a s s e s . d e x 2 A r c h i v e : p r o g r a m . a p k 3 i n f l a t i n g :c l a s s e s . d e x
www.mobileqazone.com/profiles/blogs/how-to-decompile-apk-to-source 3/6

11/24/13

How to Decompile Apk To Source - Mobile QA Zone

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 1 v e r s i o n : 0 . 0 . 7 . 8 S N A P S H O T 2 2[ m a i n ]I N F Op x b . a n d r o i d . d e x 2 j a r . v 3 . M a i n-d e x 2 j a r. / c l a s s e s . d e x& g t ; 3 . / c l a s s e s . d e x . d e x 2 j a r . j a r 4
D o n e . $b a s hd e x 2 j a r / d e x 2 j a r . s h. / c l a s s e s . d e x

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 1c o m m a n d$. / j d g u ic l a s s e s . d e x . d e x 2 j a r . j a r 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.

hope its usefull thanks & regards C.vignesh Views: 370 Tags: apk, decompilation, hacks, source, tips Like 3 members like this ShareTwitter
Like 0

Facebook

< Previous Post Next Post > Comment

You need to be a member of Mobile QA Zone to add comments!


Join Mobile QA Zone

Comment by Sameena on September 30, 2013 at 3:36pm Hi Vignesh, Can you provide some more details for step 5 described above.
www.mobileqazone.com/profiles/blogs/how-to-decompile-apk-to-source 4/6

11/24/13

How to Decompile Apk To Source - Mobile QA Zone

Below message is displayed in console: this cmd is deprecated, use the d2j-dex2jar if possible dex2jar file1.dexORapk file2.dexORapk ... dex2jar version: translator-0.0.9.15. Thanks in Advance. Regards, Sameena

Comment by Vjkumran on August 2, 2013 at 8:26pm Simple way to decompile android apk file http://qa-vijaynadeshan.blogspot.in/

Comment by Shanudeen on June 25, 2013 at 4:06pm Thanks... RSS Welcome to Mobile QA Zone

Sign Up
or Sign In Or sign in with:

Advertise Here

Mobile App Testing


zapGEN for Performance Testing of Mobile App How to Unit Test Your Android Application with Roboelectric Automate Mobile App Testing with Test Studio for iOS Automating Xamarin(iOS & Android) app with Ranorex
www.mobileqazone.com/profiles/blogs/how-to-decompile-apk-to-source 5/6

11/24/13

How to Decompile Apk To Source - Mobile QA Zone

Automation Testing of Mobile Apps with Ranorex More

Our Magazine Partner

Mobile Testing Service

2013 Created by Anurag Khode. Badges | Report an Issue | Terms of Service Sign in to chat!

www.mobileqazone.com/profiles/blogs/how-to-decompile-apk-to-source

6/6

You might also like