Add the default. properties file:
Target = Android-7
Proguard. Config = proguard. cfg
The above two sentences
Proguard. cfg file:
-Optimizationpasses 7
-Dontusemixedcaseclassnames
-Dontskipnonpubliclibraryclasses
-Dontpreverify
-Verbose
-Optimizations! Code/simplification/arithmetic ,! Field /*,! Class/merging /*
-Keep public class * extends Android. App. Activity
-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
<! -- Add the following section after using Baidu API -->
-Keep class com. Baidu. mapapi .**{*;}
-Keepclasseswithmembernames class *{
Native <Methods>;
}
-Keepclasseswithmembernames class *{
Public <init> (Android. content. Context, Android. util. attributeset );
}
-Keepclasseswithmembernames class *{
Public <init> (Android. content. Context, Android. util. attributeset, INT );
}
-Keepclassmembers class * extends Android. App. Activity {
Public void * (Android. View. View );
}
-Keepclassmembers Enum *{
Public static ** [] values ();
Public static ** valueof (Java. Lang. String );
}
-Keep class * implements Android. OS. parcelable {
Public static final Android. OS. parcelable $ creator *;
}
-Keep public class * extends Android. View. View {
Public <init> (Android. content. context );
Public <init> (Android. content. Context, Android. util. attributeset );
Public <init> (Android. content. Context, Android. util. attributeset, INT );
Public void Set *(...);
}
-Keepclassmembers class **. r$ *{
Public static <fields>;
}
<! -- The following section must be used after serialization -->
-Keepnames class * implements java. Io. serializable
-Keepclassmembers class * implements java. Io. serializable {
Static final long serialversionuid;
Private Static final java. Io. objectstreamfield [] serialpersistentfields;
! Static! Transient <fields>;
Private void writeobject (Java. Io. objectoutputstream );
Private void readobject (Java. Io. objectinputstream );
Java. Lang. Object writereplace ();
Java. Lang. Object readresolve ();
}
Add:
-Dontwarn com. Google. Android. GCM .**
-Dontwarn net. nend. Android .**
-Dontwarn com. Google. Ads .**
You can also use this method to solve the unobfuscated problem after using a third-party package. The possible exception is:
Note: There were 160 duplicate class definitions.
Warning: COM. Google. Ads. M: Can't Find referenced class com. Google. Ads. Internal. state. adstate
Warning: COM. Google. Ads. M: Can't Find referenced class com. Google. Ads. Internal. state. adstate
You shoshould check if you need to specify additional program jars.