增加代码混淆

chengzhenyu 8 anos atrás
pai
commit
84954a6204
2 arquivos alterados com 99 adições e 19 exclusões
  1. 2 2
      app/build.gradle
  2. 97 17
      app/proguard-rules.pro

+ 2 - 2
app/build.gradle

@@ -52,8 +52,8 @@ android {
52 52
             shrinkResources true
53 53
             debuggable false
54 54
             jniDebuggable false
55
-            buildConfigField "boolean", "isTestMode", "false"
56
-            proguardFile 'proguard-project.txt'
55
+            buildConfigField "boolean", "isTestMode", "true"
56
+            proguardFile 'proguard-rules.pro'
57 57
             signingConfig signingConfigs.releaseConfig
58 58
         }
59 59
         debug {

+ 97 - 17
app/proguard-rules.pro

@@ -1,17 +1,97 @@
1
-# Add project specific ProGuard rules here.
2
-# By default, the flags in this file are appended to flags specified
3
-# in C:\Android\SDK/tools/proguard/proguard-android.txt
4
-# You can edit the include path and order by changing the proguardFiles
5
-# directive in build.gradle.
6
-#
7
-# For more details, see
8
-#   http://developer.android.com/guide/developing/tools/proguard.html
9
-
10
-# Add any project specific keep options here:
11
-
12
-# If your project uses WebView with JS, uncomment the following
13
-# and specify the fully qualified class name to the JavaScript interface
14
-# class:
15
-#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16
-#   public *;
17
-#}
1
+# This is a configuration file for ProGuard.
2
+# http://proguard.sourceforge.net/index.html#manual/usage.html
3
+
4
+-dontusemixedcaseclassnames
5
+-dontskipnonpubliclibraryclasses
6
+-verbose
7
+
8
+# Optimization is turned off by default. Dex does not like code run
9
+# through the ProGuard optimize and preverify steps (and performs some
10
+# of these optimizations on its own).
11
+-dontoptimize
12
+-dontpreverify
13
+# Note that if you want to enable optimization, you cannot just
14
+# include optimization flags in your own project configuration file;
15
+# instead you will need to point to the
16
+# "proguard-android-optimize.txt" file instead of this one from your
17
+# project.properties file.
18
+
19
+-keepattributes *Annotation*
20
+-keep public class com.google.vending.licensing.ILicensingService
21
+-keep public class com.android.vending.licensing.ILicensingService
22
+
23
+# For native methods, see http://proguard.sourceforge.net/manual/examples.html#native
24
+-keepclasseswithmembernames class * {
25
+    native <methods>;
26
+}
27
+
28
+# keep setters in Views so that animations can still work.
29
+# see http://proguard.sourceforge.net/manual/examples.html#beans
30
+-keepclassmembers public class * extends android.view.View {
31
+   void set*(***);
32
+   *** get*();
33
+}
34
+
35
+# We want to keep methods in Activity that could be used in the XML attribute onClick
36
+-keepclassmembers class * extends android.app.Activity {
37
+   public void *(android.view.View);
38
+}
39
+
40
+# For enumeration classes, see http://proguard.sourceforge.net/manual/examples.html#enumerations
41
+-keepclassmembers enum * {
42
+    public static **[] values();
43
+    public static ** valueOf(java.lang.String);
44
+}
45
+
46
+-keepclassmembers class * implements android.os.Parcelable {
47
+  public static final android.os.Parcelable$Creator CREATOR;
48
+}
49
+
50
+-keepclassmembers class **.R$* {
51
+    public static <fields>;
52
+}
53
+
54
+# The support library contains references to newer platform versions.
55
+# Don't warn about those in case this app is linking against an older
56
+# platform version.  We know about them, and they are safe.
57
+-dontwarn android.support.**
58
+
59
+# Understand the @Keep support annotation.
60
+-keep class android.support.annotation.Keep
61
+
62
+-keep @android.support.annotation.Keep class * {*;}
63
+
64
+-keepclasseswithmembers class * {
65
+    @android.support.annotation.Keep <methods>;
66
+}
67
+
68
+-keepclasseswithmembers class * {
69
+    @android.support.annotation.Keep <fields>;
70
+}
71
+
72
+-keepclasseswithmembers class * {
73
+    @android.support.annotation.Keep <init>(...);
74
+}
75
+-dontwarn com.google.android.maps.**
76
+-dontwarn android.webkit.WebView
77
+-dontwarn com.umeng.**
78
+-keep class org.apache.** {*;}
79
+-keep class com.google.** {*;}
80
+-keepclassmembers class * {
81
+   public <init> (org.json.JSONObject);
82
+}
83
+-keep public class ai.pai.lensman.R$*{
84
+public static final int *;
85
+}
86
+-keepclassmembers enum * {
87
+    public static **[] values();
88
+    public static ** valueOf(java.lang.String);
89
+}
90
+-dontwarn com.tencent.**
91
+-keep public interface com.tencent.**
92
+-keep public class com.tencent.** {*;}
93
+-keep class com.tencent.mm.sdk.modelmsg.WXMediaMessage {*;}
94
+-keep class com.tencent.mm.sdk.modelmsg.** implements com.tencent.mm.sdk.modelmsg.WXMediaMessage$IMediaObject {*;}
95
+-keep class com.tencent.mm.sdk.** {
96
+   *;
97
+}