Android project obfuscated the generated jar package, androidjar

Source: Internet
Author: User

Android project obfuscated the generated jar package, androidjar

Another sleepless night

The problem is that we have written some android project code to generate a jar package and confuse the jar package without being cut by others!

First of all, you need to generate a jar package using the code. Find proguardgui. jar (directory: SDK \ tools \ proguard \ lib \) in the sdk and open it.

Then you will see the proguard page

Click Next for the first time, then go to the following page, click Addinput... to Add the jar package you want to confuse, and click Add output... to select the jar package to save the directory after obfuscation. Add... below is the jar that your jar package depends on. (The project cannot be exposed)

Click Process. Click 1 to view the configuration file. Click 2 to save the configuration file and save it as xxx. pro (for example, test. pro)

Open the test. pro file you saved and add classes and methods that are not obfuscated in your project.

Open Proguard again and add test. pro.

Click Process to check whether the configuration information has been modified. Then, click Process!


OK. obfuscation is complete. errors may occur during obfuscation. Follow the error prompts to find a solution. Most of the reasons are due to incorrect writing format during configuration!

-Optimizationpasses 5-dontusemixedcaseclassnames-dontskipnonpubliclibraryclasses-dontpreverify-verbose-optimizations! Code/simplification/arithmetic ,! Field /*,! Class/merging/*-keep public class * extends android. app. activity // inherits activity, application, service, broadcastReceiver, contentprovider .... do not confuse-keep public class * extends android. app. application-keep public class * extends android. app. service-keep public class * extends android. content. broadcastReceiver-keep public class * extends android. content. contentProvider-keep public class * extends android. app. backup. backupAgentHelper-keep public class * extends android. preference. preference-keep public class com. android. vending. licensing. ILicensingService

Delete Chinese characters when Obfuscation


-Keep class com. lidroid. xutils. ** {*;} // the entire class is not obfuscated.
-Dontwarn com. lidroid. xutils .**

// Non-obfuscated classes and Methods

-Keepclasseswithmembers public final class com. mzc. demo. MyDemo {
Public MyDemo (android. content. Context, java. lang. String, android. widget. LinearLayout );
Public void openDoor ();
}


Zookeeper

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.