Android code signature and obfuscation Packaging

Source: Internet
Author: User

After studying the mixed packaging of the android apk signature and code, if not, the apk can be decompiled directly to view the source code. Although the mixed packaging can still be understood, but it's not that easy to understand. At least it takes some time to pay for it.

If not obfuscated, The decompiled code is as follows:

Basically, it is the source code.

After obfuscation, The decompiled code is as follows: <喎?http: www.bkjia.com kf ware vc " target="_blank" class="keylink"> VcD4KPHA + pgltzybzcm9 "http://www.2cto.com/uploadfile/Collfiles/20140630/2014063013052323.jpg" alt = "\">

Many variable names such as a, B, and c appear in the code, so it is difficult to understand them!


Next, let's talk about the apk signature:

1.apk signature must first get a key. How do I generate a key? Then we need to use jdk to generate.

First, you must configure jdk in the system environment variables. This is not much to be said. It must be configured if java is used.

2. Generate a keystore


Run cmd and then use cd to go to the C: \ Program Files \ Java \ jdk1.6.0 _ 10 \ bin> directory (that is, the location where your C drive is installed with jdk, enter keytool-genkey-aliasandroid. keystore-keyalg RSA-validity 50000-keystoreandroid. keystore


-Validity indicates the validity period of the certificate, which is 50000 days.


The red android text can be changed to your own name.

After the command is executed, the android. keystore file is generated in the C: \ Program Files \ Java \ jdk1.6.0 _ 10 \ bin> directory. For example:





After obtaining the apk, You can package it and bring your own signature.

Before packaging, we need to add something to confuse the code. After packaging, the Code cannot be viewed normally after decompilation.

Obfuscation code is actually very simple. Find the project. properties file under the project to be packaged, open it, and then add a sentence at the bottom to it, for example:

The lower version of adt is not written in this way, and the higher version is OK. If it is a lower version, it is written in proguard. config = proguard. cfg. However, it is usually unavailable now, and all versions are involved. In the high version, the following error will be reported at the final step of packaging:

Invalid proguard configuration file path c:.../proguard. cfg dose not exist or is not regular file


After adding the package, you can sign and package the apk.

On the Eclipse page, click File-> Export...











Then you can! The apk with the mixed code with the signature is successful everywhere.



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.