Android basic knowledge 41: Android APK decompilation and odex conversion to Dex

Source: Internet
Author: User

Hello everyone, here we will introduce the APK decompilation operation:
1: APK Decompilation
2: Convert odex to Dex

Operating Environment: Ubuntu

A: decompilation APK

To code. Google download apktool. jar and Related Files: http://code.google.com/p/android-apktool/downloads/list

Click to download apktool-1.0.0.tar.bz2 and apktool-install-linux-2.20.r01-1.zip

Apktool command
./Apktool D geek.apk test decompile geek.apk to the folder Test

B: Convert odex to Dex

Http://code.google.com/p/smali/downloads/list

Download the following four files.

Now we need to decompile cardmanager. odex. Take cardmanager. odex as an example.

1: Java-jar baksmali-1.3.2.jar-a 12-x cardmanager. odex

// Note: the core. jar: Ext. jar: Framework. jar: Android. Policy. jar: services. jar file is supported. Some jar files in the ROM where this APK is located are in the/system/framework: core. jar, ext. jar, framework. jar, android. policy. jar, services. jar and corresponding. odex file, put these files in cardmanager. the same level of odex directory.

Run Java-jar baksmali-1.3.2.jar-a 12-x cardmanager. odex to generate an out folder where the file ends with. smali,
Note: here the parameter-A 12 should be the Android version number, and 4.0 corresponds to 14.

2: generate the classes. Dex File

Run Java-jar smali-1.3.2.jar out/-O classes. Dex

3: Download dex2jar: dex2jar-0.0.9.8.zip

Http://code.google.com/p/dex2jar/downloads/list

Unzip tar-xzvf dex2jar-0.0.9.8.tar.gz

Generate the classes_dex2jar.jar File
Dex2jar-0.0.9.8 $./dex2jar. Sh ../test_hw_odex/classes. Dex

Wanqi @ wanqi-system-product-Name :~ /Downloads/dex2jar-0.0.9.8 $./dex2jar. Sh ../test_hw_odex/classes. Dex
Dex2jar version: Translator-0.0.9.8
Dex2jar ../test_hw_odex/classes. Dex-> ../test_hw_odex/classes_dex2jar.jar

4: run the jd-gui-0.3.2.linux.i686 and open classes_dex2jar.jar. OK.

Decompile framework. odex

Java-xmx512m-jar baksmali-1.3.2.jar -- API-Level 12-C: core. jar: bouncycastle. jar: ext. jar: framework. jar: Android. policy. jar: services. jar: core-junit.jar-D Framework/-x framework. odex

Note that there may be insufficient Java memory when running these commands, So I sometimes use the following command to complete the work:

Java-jar-xmn16m-xms64m-xmx128m


References:

Android APK decompilation and odex to Dex

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.