Intellij Idea and Android studio code to confuse

Source: Internet
Author: User

 Intellij Idea and Android studio  code to confuse

I. Description of instructions
-Optimizationpasses5# Specify the compression level of the code-Dontusemixedcaseclassnames# Whether to use case blending-Dontpreverify# whether to do pre-calibration when confusing-Verbose# If the log is logged when confused-Optimizations!code/simplification/arithmetic,!field/*,!class/merging/*# The algorithm used in the confusion-Keep publicClass *ExtendsAndroid.App.Activity# Keep What classes are not confused-Keep publicClass *ExtendsAndroid.App.Application# Keep What classes are not confused-Keep publicClass *ExtendsAndroid.App.Service# Keep What classes are not confused-Keep publicClass *ExtendsAndroid.Content.Broadcastreceiver# Keep What classes are not confused-Keep publicClass *ExtendsAndroid.Content.ContentProvider# Keep What classes are not confused-Keep publicClass *ExtendsAndroid.App.Backup.Backupagenthelper# Keep What classes are not confused-Keep publicClass *ExtendsAndroid.Preference.Preference# Keep What classes are not confused-Keep publicClassCom.Android.Vending.Licensing.Ilicensingservice# Keep What classes are not confused-KeepclasseswithmembernamesClass * {# Keep native method not to be confused native <methods>;} -KeepclasseswithmembersClass * {# Keep custom control classes from being confused with public <init> (Android.content.Context, android.util.AttributeSet);} -KeepclasseswithmembersClass * {# Keep custom control classes from being confused with public <init> (Android.content.Context, android.util.AttributeSet, int);} -keepclassmembers class * extends android. App.Activity { # Keep the custom control class from being confused with public void * (Android.view.View);} -keepclassmembers enum * { # keep Enum enum class not confused public static **[] values (), public static * * VALUEOF (Java.lang.Strin g);} -Keep class * implements Android. Os. parcelable { # keep Parcelable not be confused public static final Android.os.parcelable$creator *;}

Ii. instances of Confusion

1, after the proguard-project.txt inside the configuration confusion;

2. Add proguard.config= ${sdk.dir}/tools/proguard/proguard-android.txt in project.properties: Proguard-project.txt

3. Confusing instance reference

-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontskipnonpubliclibraryclassmembers
-dontpreverify
-ignorewarnings
-verbose
-optimizations!code/simplification/arithmetic,!field/*,!class/merging/*


-dontwarn android.support.**
-dontwarn com.handmark.**
-dontwarn Android.webkit.WebView

-keepclassmembers class youmengyou.bean.** {
Public <fields>;
Private <fields>;
public <init> ();
Public <init> (Org.json.JSONObject);
*;
}

#保持 Native method is not confused
-keepclasseswithmembernames class * {
Native <methods>;
}

#保持自定义控件类不被混淆
-keepclasseswithmembers class * {
Public <init> (Android.content.Context, Android.util.AttributeSet);
}

#保持自定义控件类不被混淆
-keepclasseswithmembers 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>;
public static final int *;
}
-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 ();
}
-keepattributes exceptions,innerclasses,signature
-keepattributes *annotation*
-keepattributes sourcefile,linenumbertable

-keep public class * extends Android.app.Activity
-keep public class * extends Android.app.Application
-keep public class * extends Android.app.IntentService
-keep public class * extends Android.app.Service
-keep public class * extends Android.app.backup.BackupAgentHelper
-keep public class * extends Android.content.BroadcastReceiver
-keep public class * extends Android.content.ContentProvider
-keep public class * extends Android.preference.Preference
-keep public class Com.android.vending.licensing.ILicensingService
-keep public class * extends Android.widget.LinearLayout
-keep public class * extends Android.widget.FrameLayout
-keep public class * extends Android.widget.CheckBox
-keep class android.** {*; }
-keep public class javax.**
-keep class org.** {*; }
-keep class android.support.v4.** {*;}
-keep class android.support.v4.app.** {*; }
-keep class android.support.v4.view.** { *;
-keep public class * extends android.support.v4.**
-keep public class android.webkit.**


#加解密
#-keep public class Com.jfw.utils.ThreeDES

-keep interface android.support.v4.app.** { *;}
#下拉刷新
-keep class com.handmark.** { *;}

Three, the last step, packaging, signing

Used to think IntelliJ idea and Android studio In the proguard-project.txt inside set, in the compile time directly to confuse the code, after their own anti-compilation only found, what is confused, there is still an operation did not do, need to generate signed APK (signature) tick on run Proguard is fine.







Intellij Idea and Android studio code to confuse

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.