Commit b0a3a1e4be22f197223f87960ef13f04597aab08

Authored by 谷俊
1 parent b6285def

添加混淆代码

.idea/modules.xml
... ... @@ -3,6 +3,8 @@
3 3 <component name="ProjectModuleManager">
4 4 <modules>
5 5 <module fileurl="file://$PROJECT_DIR$/CNLivePayDemo.iml" filepath="$PROJECT_DIR$/CNLivePayDemo.iml" />
  6 + <module fileurl="file://$PROJECT_DIR$/CNLivePayDemo.iml" filepath="$PROJECT_DIR$/CNLivePayDemo.iml" />
  7 + <module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
6 8 <module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
7 9 </modules>
8 10 </component>
... ...
app/build.gradle
... ... @@ -23,13 +23,19 @@ android {
23 23  
24 24 buildTypes {
25 25 release {
26   - minifyEnabled false
  26 + minifyEnabled true
27 27 proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
  28 + signingConfig signingConfigs.myConfig
28 29 }
29 30 debug {
30 31 signingConfig signingConfigs.myConfig
31 32 }
32 33 }
  34 +
  35 + lintOptions {
  36 + abortOnError false
  37 + }
  38 +
33 39 }
34 40  
35 41 dependencies {
... ...
app/proguard-rules.pro
  1 +# 通用混淆配置
  2 +#不混淆泛型 -keepattributes SourceFile
  3 + -keepattributes Signature,InnerClasses,Exceptions,Deprecated,SourceFile,LineNumberTable,*Annotation*,EnclosingMethod
  4 +
  5 + -optimizationpasses 5
  6 + -dontusemixedcaseclassnames
  7 + -dontskipnonpubliclibraryclasses
  8 + -dontpreverify
  9 + -verbose
  10 + -optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
  11 +
  12 + #忽略警告 也可以用-ignorewarnings
  13 + -dontwarn
  14 +
  15 + -keep public class * extends android.app.Activity
  16 + -keep public class * extends android.app.Application
  17 + -keep public class * extends android.app.Service
  18 + -keep public class * extends android.content.BroadcastReceiver
  19 + -keep public class * extends android.content.ContentProvider
  20 + -keep public class * extends android.app.backup.BackupAgentHelper
  21 + -keep public class * extends android.preference.Preference
  22 + -keep public class com.android.vending.licensing.ILicensingService
  23 +
  24 + -keepclasseswithmembernames class * {
  25 + native <methods>;
  26 + }
  27 +
  28 + -keepclasseswithmembers class * {
  29 + public <init>(android.content.Context, android.util.AttributeSet);
  30 + }
  31 +
  32 + -keepclasseswithmembers class * {
  33 + public <init>(android.content.Context, android.util.AttributeSet, int);
  34 + }
  35 +
  36 + -keepclassmembers class * extends android.app.Activity {
  37 + public void *(android.view.View);
  38 + }
  39 +
  40 + -keepclassmembers enum * {
  41 + public static **[] values();
  42 + public static ** valueOf(java.lang.String);
  43 + }
  44 +
  45 + -keep class * implements android.os.Parcelable {
  46 + public static final android.os.Parcelable$Creator *;
  47 + }
  48 +
  49 +# 通用混淆配置 End
  50 +
1 51 -keepattributes Signature
2 52 -dontwarn com.cnlive.**
3 53 -keep class com.cnlive.** {*;}
  54 +-dontwarn com.ksy.**
  55 +-keep class com.ksy.** {*;}
  56 +-dontwarn io.rong.**
  57 +-keep class io.rong.** {*;}
4 58  
5 59 ##############
6 60 ## weixin pay ##
... ... @@ -13,11 +67,7 @@
13 67 ##############
14 68 ## alipay ##
15 69 ##############
16   --keep class com.alipay.android.app.IAlixPay{*;}
17   --keep class com.alipay.android.app.IAlixPay$Stub{*;}
18   --keep class com.alipay.android.app.IRemoteServiceCallback{*;}
19   --keep class com.alipay.android.app.IRemoteServiceCallback$Stub{*;}
20   --keep class com.alipay.sdk.app.PayTask{ public *;}
21   --keep class com.alipay.sdk.app.AuthTask{ public *;}
  70 +-keep class com.alipay.** {*;}
  71 +-dontwarn com.alipay.**
22 72 ## alipay END
23 73  
... ...