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 );
}
}