Intellij idea and android studio code are mixed, intellijandroid

Source: Internet
Author: User

Intellij idea and android studio code are mixed, intellijandroid

Intellij idea and android studioCode obfuscation

I. Instructions
-Optimizationpasses 5 # specify the compression level of the code-dontusemixedcaseclassnames # whether to use case-insensitive mixture-dontpreverify # Whether to perform pre-check-verbose # Whether to log-optimizations during obfuscation! Code/simplification/arithmetic ,! Field /*,! Class/merging/* # algorithm used for obfuscation-keep public class * extends android. app. activity # keep classes that are not Obfuscated-keep public class * extends android. app. application # keep classes that are not Obfuscated-keep public class * extends android. app. service # Do not confuse classes-keep public class * extends android. content. broadcastReceiver # keep classes that are not Obfuscated-keep public class * extends android. content. contentProvider # Do not confuse classes-keep public class * extends android. app. backup. backupAgentHelper # keep classes that are not Obfuscated-keep public class * extends android. preference. preference # keep classes that are not Obfuscated-keep public class com. android. vending. licensing. ILicensingService # Keep classes not Obfuscated-keepclasseswithmembernames class * {# Keep native METHOD not obfuscated native <methods> ;} -keepclasseswithmembers class * {# Keep the custom control class not obfuscated with public <init> (android. content. context, android. util. attributeSet);}-keepclasseswithmembers class * {# Keep the custom control class not obfuscated 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 The enum class from being confused public static ** [] values (); public static ** valueOf (java. lang. string);}-keep class * implements android. OS. parcelable {# Keep Parcelable not to be confused public static final android. OS. parcelable $ Creator *;}

Ii. obfuscation of instances

1、after configuration obfuscation in proguard-project.txt;

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

3. Confusion 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 );
*;
}

# Keep native methods not obfuscated
-Keepclasseswithmembernames class *{
Native <methods>;
}

# Keep custom control classes unobfuscated
-Keepclasseswithmembers class *{
Public <init> (android. content. Context, android. util. AttributeSet );
}

# Keep custom control classes unobfuscated
-Keepclasseswithmembers class *{
Public <init> (android. content. Context, android. util. AttributeSet, int );
}

# Keep custom control classes unobfuscated
-Keepclassmembers class * extends android. app. Activity {
Public void * (android. view. View );
}

# Keep enumeration classes unobfuscated
-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 .**


# Encryption and decryption
#-Keep public class com. jfw. utils. ThreeDES

-Keep interface android. support. v4.app .**{*;}
# Pull-down refresh
-Keep class com. handmark .**{*;}

 

3. Packaging and signing

Previously, I thought Intellij idea and android studio had been set up in proguard-project.txt, and the code was directly obfuscated during compilation. Later I decompiled the code and found that everything was obfuscated, it turns out that there is still an operation not done. You need to check Run ProGuard when Generate Signed APK (signature.







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.