Code obfuscation in Android development and android development Obfuscation

Source: Internet
Author: User

Code obfuscation in Android development and android development Obfuscation

1. Start the obfuscation switch.
In the project. properties file under the project directory, it is named as the proguard. config tag. By default, it is disabled. Open it. 2. perform obfuscation Configuration
Perform specific obfuscation configuration in the proguard-project.txt file under the project directory. Right-click the project after configuration and select export to export the apk package. This apk package is a confusion package.

For example, the package name is com. test.

-Dontwarn org.*
-Keepattributes EnclosingMethod, InnerClasses
-Keepattributes * Annotation
 
-Keepattributes Signature
-Keepattributes SourceFile, LineNumberTable

# Configure classes without Obfuscation
-Keep class android. support.*{*;}
-Keep class com. test. model.
*{*;}

# Configure non-obfuscation enumeration types
-Keepclassmembers enum *{*;}

# Configure member variables that are not obfuscated
-Keepclassmembernames class com. test. db. Table {
Public long *;
}

For more information, see: http://developer.android.com/guide/developing/tools/proguard.html

Linghaihua
How to encrypt or confuse code in Android development?

1. The public function of a specific class does not actually do anything. It only performs simple processing and then calls the private function. Proguard will not confuse some public functions of a specific class, so that they can be referenced by AndroidManifest. xml and various layout functions. 2. Classes referenced by AndroidMinifest. xml and layout will be placed in a shallow package, and classes to be hidden will be placed in a deeper depth, so that proguard can confuse the package name to bring benefits. If a package contains non-obfuscation content, the entire package name will not be confused. 3. sharding functions by function will also be helpful.

Your access failed

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.