Decompile android apk in ubuntu

Source: Internet
Author: User
Tags deprecated

Decompile Apk using ApkTool
Download apktool1.4.3.tar.bz2 unzip apktool-install-linux-r04-brut1.tar.bz2 and decompress the package to a directory. decompress the package to obtain aapt apktool. jar. Run the following command to decompress the package:
[Plain]
<SPAN xmlns = "http://www.w3.org/1999/xhtml"> $./apktool d apk/xgd_android_test.apk
I: Baksmaling...
I: Loading resource table...
I: Loaded.
I: Loading resource table from file:/home/yangyupeng/apktool/framework/1.apk
I: Loaded.
I: Decoding file-resources...
W: Cant find 9 patch chunk in file: "drawable-mdpi/navbar.9.png". Renaming it to *. png.
I: Decoding values */* XMLs...
I: Done.
I: Copying assets and libs...
</SPAN>

$./Apktool d apk/xgd_android_test.apk
I: Baksmaling...
I: Loading resource table...
I: Loaded.
I: Loading resource table from file:/home/yangyupeng/apktool/framework/1.apk
I: Loaded.
I: Decoding file-resources...
W: Cant find 9 patch chunk in file: "drawable-mdpi/navbar.9.png". Renaming it to *. png.
I: Decoding values */* XMLs...
I: Done.
I: Copying assets and libs...

Display as above. Note the apktool parameter. d Indicates decode and B indicates build. At this time, the apk decompression file is generated in the current directory:

[Html]
<SPAN xmlns = "http://www.w3.org/1999/xhtml"> <SPAN xmlns = "http://www.w3.org/1999/xhtml"> 1/xgd_android_test $ ls
AndroidManifest. xml apktool. yml lib res smali
</SPAN>

1/xgd_android_test $ ls
AndroidManifest. xml apktool. yml lib res smali

The source code (smali), image, xml configuration, and language configuration of apk are provided here.


Use dex2jar and JD-JUI tools to view java source code
Download dex2jar, JD-JUI two packages, unzip.
Change the suffix of apk to zip and decompress the classes. dex file. In the dex2jar directory, enter the following command to get the. jar file:
[Plain]
<SPAN xmlns = "http://www.w3.org/1999/xhtml"> $./dex2jar. sh classes. dex
This cmd is deprecated, use the d2j-dex2jar if possible
Dex2jar version: translator-0.0.9.9
Dex2jar classes. dex-> classes_dex2jar.jar
Done.
</SPAN>

$./Dex2jar. sh classes. dex
This cmd is deprecated, use the d2j-dex2jar if possible
Dex2jar version: translator-0.0.9.9
Dex2jar classes. dex-> classes_dex2jar.jar
Done.

Open the file with JD-JUI to view the source code:


Comparison with source code:
[Java]
<SPAN xmlns = "http://www.w3.org/1999/xhtml"> package xgd. android;
 
Import android. app. Activity;
Import android. OS. Bundle;
 
Public class ICCardActivity extends Activity {
 
@ Override
Protected void onCreate (Bundle savedInstanceState ){
// TODO Auto-generated method stub
Super. onCreate (savedInstanceState );
SetContentView (R. layout. iccard );
}
 
 
}
</SPAN>

Package xgd. android;

Import android. app. Activity;
Import android. OS. Bundle;

Public class ICCardActivity extends Activity {

@ Override
Protected void onCreate (Bundle savedInstanceState ){
// TODO Auto-generated method stub
Super. onCreate (savedInstanceState );
SetContentView (R. layout. iccard );
}


}


 

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.