Android Reverse Engineering and Decompilation

Reverse engineering of android java app using apktool, dex2jar, jd-gui to convert .apk file to .java.

By reverse engineering of android app (.apk file) we can get following :

  • understand how a particular UI in an App is constructed
  • reading AndroidManifest.xml – permissions, activities, intents etc in the App
  • native libraries and images used in that App
  • obsfucated code ( android SDK, by default, uses ProGuard tool which shrinks, optimizes, and obfuscates your code by removing unused code and renaming classes, fields, and methods with semantically obscure names.

 

Required Tools :

Download the followings first.

Using ApkTool

- to extract AndroidManifest.xml and everything in res folder(layout xml files, images, htmls used on webview etc..)

Run the following command :

>apktool.bat d sampleApp.apk

It also extracts the .smali file of all .class files, but which is difficult to read.

##You can achieve this by using zip utility like 7-zip.

Using dex2jar

- to generate .jar file from .apk file, we need JD-GUI to view the source code from this .jar.

Run the following command :

 >dex2jar sampleApp.apk

Decompiling .jar JD-GUI

- it decompiles the .class files (obsfucated- in case of android app, but readable original code is obtained in case of other .jar file). i.e., we get .java back from the application.

Just Run the

jd-gui.exe and File->Open to view java code from .jar or .class file.

You May Also Like -

 
Reference: Android Reverse Engineering – decompile .apk-.dex-.jar-.java from our JCG partner Ganesh Tiwari at the GT’s Blog blog.

Related Whitepaper:

Rapid Android Development: Build Rich, Sensor-Based Applications with Processing

Create mobile apps for Android phones and tablets faster and more easily than you ever imagined

Use 'Processing', the free, award-winning, graphics-savvy language and development environment, to work with the touchscreens, hardware sensors, cameras, network transceivers, and other devices and software in the latest Android phones and tablets.

Get it Now!  

3 Responses to "Android Reverse Engineering and Decompilation"

  1. With AndroChef Java Decompiler you can decompile apk., dex, jar and java class-files. It’s simple and easy. http://www.androiddecompiler.com/

  2. Freeman Mobile says:

    This way is just fine!
    But JD-GUI homepage has changed!
    Follow this tutorial to get updated link of JD-GUI
    How to decompile Android APK file

  3. Venkatesan says:

    Hi,

    I am very much eager to become a very good Android Development Engineer.I need one help from you.Currently I am having Source files,fully layout file and a manifest file.Will u go through it and compile it and help me.This project will help me out to become a very good Android Engineer.please help me.

    Thanks and Regards,
    Venkatesan.R

Leave a Reply


+ 2 = eleven



Java Code Geeks and all content copyright © 2010-2014, Exelixis Media Ltd | Terms of Use
All trademarks and registered trademarks appearing on Java Code Geeks are the property of their respective owners.
Java is a trademark or registered trademark of Oracle Corporation in the United States and other countries.
Java Code Geeks is not connected to Oracle Corporation and is not sponsored by Oracle Corporation.

Sign up for our Newsletter

15,153 insiders are already enjoying weekly updates and complimentary whitepapers! Join them now to gain exclusive access to the latest news in the Java world, as well as insights about Android, Scala, Groovy and other related technologies.

As an extra bonus, by joining you will get our brand new e-books, published by Java Code Geeks and their JCG partners for your reading pleasure! Enter your info and stay on top of things,

  • Fresh trends
  • Cases and examples
  • Research and insights
  • Two complimentary e-books