Proguard Android code obfuscation prevents Decompilation

Source: Internet
Author: User

To achieve code obfuscation, the method is as follows:

Because both my SDK and adt00000.1 are up-to-date, I have read the proguard. cfg obfuscation code method provided on the Internet,
. It is said that proguard. cfg will be automatically generated under the project file, but I cannot generate it, so I cannot use this method, which is a headache.

But today at the time of reading, found in fact under the project file, automatically generated the file: proguard-project.txt, project. properties two files, so is to open these two files, in proguard-project.txt has:

By default, the flags in this file are appended to flags specified
# In $ {SDK. dir}/tools/proguard/proguard-android.txt
If you open the proguard-android.txt file, it is found that the content is similar to the progurad. cfg mentioned above, and the estimation function is the same.

In the file project. properties, there are:

To enable proguard to shrink and obfuscate your code, uncomment this (available properties: SDK. dir, user. Home ):
# Proguard. config =$ {SDK. dir}/tools/proguard/proguard-android.txt: proguard-project.txt

Obviously, to use proguard to confuse code, you just need to restore this annotation. # proguard. config =$ {SDK. dir}/tools/proguard/proguard-android.txt: proguard-project.txt.

But it cannot just restore the comments. After I try it, I only need to put this sentence proguard. config =$ {SDK. dir}/tools/proguard/proguard-android.txt: The proguard-project.txt is placed after target = Android-10 to generate the APK.

 

Next, decompile the exported APK as follows:

 

In the generated JAR file, all the class names and variable names are changed to A, B, C, and other names that cannot be correctly understood, achieving the expected results.

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.