first, Apktools for anti-compilation
1. First install requires Java environment (JDK and JRE)setting Java environment VariablesCLASSPATH%java_home%\lib\dt.jar;%java_home%\lib\tools.jarjava_home C:\Program files\java\jdk1.8.0_20Path%java_home%\bin; C:\Program Files\java\jre1.8.0_20\bin
2. Download Apktools and Unzip(1) Download Apktool_2.0.0rc4.jar and apktool-install-windows-r04-brut1.tar.bz2Address: Http://code.google.com/p/android-apktool/downloads/list(2) Two files are unpacked in the same directory, a total of three filesAapt.exeApktool.batApktool.jarwhere Apktool.jar is used for unpacking, Apktool.jar and Aapt.exe are used for packaging. (3) Click on the Start menu. Run, enter the CMD carriage return, use the CD command to go to the folder where you just unzipped the apktool-install-windows, enter Apktool, and some command instructions are installed successfully. Of course, we can also put three files directly in the Windows directory of the C disk, you can directly use Apktool.
3.apktools How to use
(1) Anti-compilation and packaging commandsanti-compile command:usage:apktool d[ecode] [options] <file_apk> -F,--Force force Delete destination directory.-o,--output <dir> The name of folder that gets written. Default is Apk.ou T -P,--frame-path <dir> Uses framework files located in <dir>.-R,--no-res do not decode resources.-S,--no-src do not decode sources.-T,--frame-tag <tag> Uses framework files tagged by <tag>.Packaging Commands:usage:apktool b[uild] [options] <app_path> -F,--force-all Skip changes detection and build all files.-o,--output <dir> The name of the apk that gets written. Default is dist/name apk
(2) to store the APK app in the current directory (assumed to be the D packing directory), decompile
then, in the current directory, you see the Anti-compilation folder " "
second, Apktools to re-package
after we have modified the cracked apk, we can repackage it back to the APK file and execute the command:
apktool b <decode_dir> , and then we see the packaged apk in the current directory. Since the APK has not yet been signed, it is generally not possible to install. At this point, you can generate a certificate (. keystore file) from the Keytool tool, and finally use the Jarsigner tool to sign the APK app. The
steps are as follows :
1. Use Apktool rewrite to package apk after the modified application source rewrite package back to the APK, mainly using Aapt.exe,apktool.jar two tools. Note that it is best to download the latest version of Aapt.exe (also available from the Android SDK's Build-tools directory) and Apktool tools from Google's official website.
2. Generate a signing certificate using the Keytool toolkeytool-genkey-v -keystore 2015.keystore-alias 2015.keystore -keyalg rsa-validity 20000Description:1) Keytool is the tool name,-genkey means to generate a digital certificate operation, and-V to print out the details of the generated certificate, displayed in the DOS window;2)-keystore . KeyStore indicates the file name of the generated digital certificate is ". KeyStore";3)-alias . KeyStore indicates that the certificate has an aliasof ". KeyStore", which can of course not be the same as the file name above;4)-keyalg RSA indicates that the algorithm used to generate the key file is RSA;5)-validity 20000 indicates that the digital certificate is valid for 20,000 days, meaning that the certificate will expire after 20,000 dayswhen you execute the above command to generate a digital certificate file, you are prompted to enter some information, including the certificate's password, as shown in the following example:
Note: The command succeeds, and the system generates a "2015.keystore" certificate in the current directory (C:\Users\jiangdongguo).
3. Sign the Android app with the Jarsigner tooljarsigner-verbose -keystore 2015.keystore -signedjar2015_signed.apk 2015.apk 2015.keystor E Description:1) Jarsigner is the tool name,-verbose indicates the details of the signature process is printed out, displayed in the DOS window;2)-keystore . KeyStore represents the location of the digital certificate used by the signature, there is no write path, which is indicated in the current directory ;3)-signedjar 2015_signed.apk 2015.apk is signed to notepad.apk file, signed file name is 2015_signed.apk;4) The last 2015.keystore represents the alias of the certificate, which corresponds to the name after the-alias parameter when generating the digital certificatenotes:Keytool Tool: The tool is located in the bin directory of the JDK installation path;Jarsigner Tool: The tool is located in the bin directory of the JDK installation path;
Third, frequently asked questions
1. about installing and managing the framework files
1. $ apktool D htccontacts.apk2. i:loading Resource Table ...3. i:decoding Resources ...4. i:loading Resource table from file:/home/brutall/apktool/framework/1.apk5. W:could not decode attr value, using undecoded value instead:ns=android, name=drawable, value=0x020205426 .... .7. W:could not decode attr value, using undecoded value instead:ns=android, Name=icon, value=0x020205208. Can ' t find framework resources for the Id:2. Must install proper framework files, see project Websi Te for more info..........w:could not decode attr value, using undecoded value instead:ns=android, name=hardwareaccelerated, value=0xffffffff< /c0>...
cause: TheC:\Users\jiangdongguo\apktool\framework\1.apk version is too low. There are no other things to do before using Apktool for anti-compilation, but since some vendors such as HTC, Samsung, etc., they have customized the framework files and used them in their system applications, in order to be able to decompile these apk files properly, You will have to copy the framework files from your device and install them into Apktool.
Solution :
This assumes that the framwork-res.apk file is placed in the D-Packing directory
2. There are no public.xml resources defined errors
Reason:
In fact, in the compilation process will encounter many other problems, most of them because of the deletion, modification, the addition of resources, there is no corresponding modification of the Res\values\public.xml file caused by.
Solution Solutions
(1) The resources in the Public.xml file cannot be defined repeatedly.
(2) The ID of any two resources in the Public.xml file cannot be the same
(3) The resource defined in the Public.xml file must be able to locate the file (if you delete some files, you must delete the Public.xml in the corresponding row)
(4) as comprehensive as possible in the Public.xml file (if you add a resource, it is best to make sure it is also added in Public.xml)
(5) The ID of the resource in the Public.xml file is as contiguous as possible (when you add a claim to the added file, the ID given is as contiguous as possible)
Summary: Many times because the Apktool version is too low to cause errors, we need to go to Google's official website to download the latest version of the Apktool and Aapt.exe tools, and then directly placed in the system disk (C) of the Windows directory can be.
Reference:http://blog.csdn.net/lyq8479/article/details/6401093http://www.cnblogs.com/CuriosityWzk/archive/2012/01/06/2315150.html
Android app Hack (anti-compilation)