Dex2jar Steps

6
11/24/13 How to Decompile Apk To Source - Mobile QA Zone www.mobileqazone.com/profiles/blogs/how-to-decompile-apk-to-source 1/6 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 need- 1. Eclipse IDE 2. Java Runtime (of course) 3. JD-GUI or JD Eclipse plugin 4. 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.

description

android2javaandroid2javaandroid2javaandroid2javaandroid2javaandroid2javaandroid2javaandroid2java

Transcript of Dex2jar Steps

Page 1: Dex2jar Steps

11/24/13 How to Decompile Apk To Source - Mobile QA Zone

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

Search Mobile QA Zone Search

Sign Up

Sign In

Mobile QA Zone

A Mobile Application Testing Community

Home

My Page

CommunityMobile Testing Tools

Mobile App Testing

We RecommendAbout Us

All Blog PostsMy Blog

Add

How to Decompile Apk To Source

Posted by vignesh on June 25, 2013 at 3:30pmView 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 need-

1. Eclipse IDE2. Java Runtime (of course)

3. JD-GUI or JD Eclipse plugin

4. 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.

Welcom e to Mobile QA Zon e, a Nex t Gen er a t ion Softw a r e Test in g Com m u n ity .

Page 2: Dex2jar Steps

11/24/13 How to Decompile Apk To Source - Mobile QA Zone

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

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 tobuild 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

Page 3: Dex2jar Steps

11/24/13 How to Decompile Apk To Source - Mobile QA Zone

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

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:

123

command :$ unzip program.apk classes.dex

Archive: program.apk

inflating: classes.dex

Page 4: Dex2jar Steps

11/24/13 How to Decompile Apk To Source - Mobile QA Zone

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

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

1234

$ 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 toextract the source code:link for jd-gui http://java.decompiler.free.fr/?q=jdgui

1command $ ./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.

hope its usefull

thanks & regards

C.vignesh

Views: 370

Tags: apk, decompilation, hacks, source, tips

Like3 members like this

ShareTwitter Facebook

< Previous PostNext 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.

Like 0

Page 5: Dex2jar Steps

11/24/13 How to Decompile Apk To Source - Mobile QA Zone

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

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:06pmThanks...

RSS

Welcome to

Mobile QA Zone

Sign Upor 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