Confusing package sharing for ANDROID applications

  • 2020-05-24 06:06:40
  • OfStack

Confusing packaging of android applications
1. Add the following proguard.config = proguard.cfg to the project document project.properties, as follows:
target=android-8

proguard.config=proguard.cfg

Eclipse will use this configuration to generate the proguard.cfg file in the project directory

2. Generate keystore (if available)

Follow the command line below in D:\Program Files\Java\ jdk1.6.0_07 \bin > From the directory, enter keytool-genkey-alias android. keystore-keyalg RSA-validity 100000 -keystore android. keystore

Parameter meaning: -validity is mainly the validity of the certificate, write 100,000 days; Spaces, backspace are passwords.

Command will be executed at D:\Program Files\Java\ jdk1.6.0_07 \bin > Generate the android.keystore file in the directory.

3. Operation in Eclipce

File - > Export - > Export Android Application - > Select project - > Using the existing keystore , and input password - > select the destination APK file

After the confusion of the source code, the original class name and method name will be similar to a,b,c... The principle of confusion is the mapping of the class name to the method name.

But the big four components are not confused (all the components defined in the manifest file cannot be confused), because the system needs the manifest file to find and run the application.

proguard.cfg file code interpretation

-optimizationpasses 5 - > Set the obfuscated compression ratio from 0 to 7

-dontusemixedcaseclassnames - > Aa aA

-dontskipnonpubliclibraryclasses - > If the application introduces an jar package and wants to confuse the class in the jar package

-dontpreverify

-verbose - > Production mapping file map class name after confusion - > Mapping of transformed class names

-optimizations !code/simplification/arithmetic,!field/*,!class/merging/* - > Obfuscating the algorithm used.

-keep public class * extends android.app.Activity - > All subclasses of activity should not be confused

-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

-keepclasseswithmembernames class * {

native < methods > ; - > All native methods must not be confused.

}

-keepclasseswithmembers class * {

public < init > (android.content.Context, android.util.AttributeSet);

-- > Some constructs cannot be confused

}

-keepclasseswithmembers class * {

public < init > (android.content.Context, android.util.AttributeSet, int);

}

-keepclassmembers class * extends android.app.Activity {

public void *(android.view.View);

}

-keepclassmembers enum * { - > Enumeration classes cannot be confused.

public static **[] values();

public static ** valueOf(java.lang.String);

}

-keep class * implements android.os.Parcelable { - > aidl files should not be confused.

public static final android.os.Parcelable$Creator *;

}


Related articles: