Android de-authorization decompile, signature, zipalign optimization

Source: Internet
Author: User

anti-compilation : On Tool apktool

Download self Search Google Apktool GitHub

CD Apktool Directory

Java-jar apktool_2. 0.1. Jar D xx.apk

Generate XX directory is decompile files, configuration and resource files can be directly edited, but Java source code in the Smali directory, is the Smali file.

Java-jar apktool_2. 0.1. Jar B XX

Back to the APK, now cannot be installed directly using, can be USB debug installation, that is, ADB install-r xx.apk

Signature:JDK's own signature method

Need to use the Keytool.exe (located in the Jdk1.6.0_24\jre\bin directory), using the generated key pair apk signature is Jarsigner.exe (located in the Jdk1.6.0_24\bin directory)

Need to configure Java_home and jre_home (self-configuring)

Generate key

Keytool-genkey-alias xx.keystore-keyalg rsa-validity 10000 -keystore Xx.keystore
REM  Description:-Genkey generates key REM       -aliasxx.keystore aliases Xx.keystorerem       -keyalg RSA Using the RSA algorithm to encrypt the       signature rem10000  validity period 4,000       days REM-keystore Xx.keystore */
Jarsigner-verbose-keystore Xx.keystore-signedjar xx_signed.apk demo.apk xx.keystore
/* Description:-verbose The details of the output signature rem        -keystore  xx.keystore keystore location rem        -signedjar xx_signed.apk xx.apk Xx.keystore formally signed, three parameters in order to generate the file xx_signed, the file to be signed xx.apk and KeyStore Xx.keystore. */

The signature is ready and can be installed.

Zipalign optimization

Unsigned apk cannot be used, nor can it be optimized. After signing the APK Google recommends using Zipalign.exe (located in the xx\adt-bundle-windows-x86-20140702\sdk\build-tools\21.1.2 directory or other SDK version corresponding directory) tool to optimize it:

4 xx_signed.apk final.apk

As above, Zipalign enables the uncompressed data in the APK file to be aligned on a 4-byte boundary (4 bytes is a well-performing value) so that the Android system can read the file using the Mmap () function (see the purpose of the function itself) to get higher performance on read resources ,

Ps:1. Alignment on a 4-byte boundary means that, in general, the compiler bar 4 bytes are read as a unit, so that the CPU can access the variable efficiently and quickly (not before).
2. The root cause of alignment: The Davlik virtual machine in the Android system uses its own proprietary format DEX,DEX structure is compact, in order to make the performance of the runtime better, can further use "alignment" further optimization, but the size will generally increase.

anti-compile Dex files:Dex2jar

The above only decompile the resource configuration file, Java files need to Dex2jar,

Unzip the APK file and locate the Dex file

Dex2jar.bat    Xx.dex

You can get the jar file and decompile the Java file by Jd_gui.

For Odex apk need to go Odex, decompile, and Smali file to Dex, and Smali editor, next time.

Android de-authorization decompile, signature, zipalign optimization

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.