feat: 优化

pull/226/head
gedoor 5 years ago
parent 6d087c1027
commit 50c5385889
  1. 3
      app/build.gradle
  2. 81
      app/proguard-rules.pro
  3. 2
      build.gradle
  4. 4
      gradle/wrapper/gradle-wrapper.properties

@ -66,7 +66,6 @@ android {
applicationIdSuffix '.debug' applicationIdSuffix '.debug'
versionNameSuffix 'debug' versionNameSuffix 'debug'
minifyEnabled false minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
} }
android.applicationVariants.all { variant -> android.applicationVariants.all { variant ->
variant.outputs.all { variant.outputs.all {
@ -121,7 +120,7 @@ dependencies {
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1' implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
//androidX //androidX
implementation 'androidx.core:core-ktx:1.2.0' implementation 'androidx.core:core-ktx:1.3.0'
implementation 'androidx.appcompat:appcompat:1.1.0' implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.media:media:1.1.0' implementation 'androidx.media:media:1.1.0'
implementation 'androidx.preference:preference:1.1.1' implementation 'androidx.preference:preference:1.1.1'

@ -58,21 +58,20 @@
# 保留我们使用的四大组件,自定义的Application等等这些类不被混淆 # 保留我们使用的四大组件,自定义的Application等等这些类不被混淆
# 因为这些子类都有可能被外部调用 # 因为这些子类都有可能被外部调用
-keep public class * extends android.app.Activity -keep public class * extends android.app.Activity
-keep public class * extends android.app.Appliction -keep public class * extends android.app.Application
-keep public class * extends android.app.Service -keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver -keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider -keep public class * extends android.content.ContentProvider
-keep public class * extends android.app.backup.BackupAgentHelper -keep public class * extends android.app.backup.BackupAgentHelper
-keep public class * extends android.preference.Preference -keep public class * extends android.preference.Preference
-keep public class * extends android.view.View -keep public class * extends android.view.View
-keep public class com.android.vending.licensing.ILicensingService
# 保留androidx下的所有类及其内部类 # 保留androidx下的所有类及其内部类
-keep class androidx.** {*;} -keep class androidx** {*;}
# 保留继承的 # 保留继承的
-keep public class * extends androidx.** -keep public class * extends androidx**
# 保留R下面的资源 # 保留R下面的资源
-keep class **.R$* {*;} -keep class **.R$* {*;}
@ -105,6 +104,7 @@
# 保留Parcelable序列化类不被混淆 # 保留Parcelable序列化类不被混淆
-keep class * implements android.os.Parcelable { -keep class * implements android.os.Parcelable {
#noinspection ShrinkerUnresolvedReference
public static final android.os.Parcelable$Creator *; public static final android.os.Parcelable$Creator *;
} }
@ -128,16 +128,11 @@
} }
# webView处理,项目中没有使用到webView忽略即可 # webView处理,项目中没有使用到webView忽略即可
-keepclassmembers class fqcn.of.javascript.interface.for.webview { -keepclassmembers class * extends android.webkit.WebViewClient {
public *; public void *(android.webkit.WebView, java.lang.String);
}
-keepclassmembers class * extends android.webkit.webViewClient {
public void *(android.webkit.WebView, java.lang.String, android.graphics.Bitmap); public void *(android.webkit.WebView, java.lang.String, android.graphics.Bitmap);
public boolean *(android.webkit.WebView, java.lang.String); public boolean *(android.webkit.WebView, java.lang.String);
} }
-keepclassmembers class * extends android.webkit.webViewClient {
public void *(android.webkit.webView, jav.lang.String);
}
# 移除Log类打印各个等级日志的代码,打正式包的时候可以做为禁log使用,这里可以作为禁止log打印的功能使用 # 移除Log类打印各个等级日志的代码,打正式包的时候可以做为禁log使用,这里可以作为禁止log打印的功能使用
# 记得proguard-android.txt中一定不要加-dontoptimize才起作用 # 记得proguard-android.txt中一定不要加-dontoptimize才起作用
@ -151,11 +146,11 @@
} }
# 保持js引擎调用的java类 # 保持js引擎调用的java类
-keep class **.analyzeRule.**{*;} -keep class **.analyzeRule**{*;}
# 保持web类 # 保持web类
-keep class **.web.**{*;} -keep class **.web**{*;}
#数据类 #数据类
-keep class **.data.**{*;} -keep class **.data**{*;}
-dontwarn rx.** -dontwarn rx.**
@ -170,55 +165,53 @@
-dontwarn org.conscrypt.** -dontwarn org.conscrypt.**
-dontwarn com.jeremyliao.liveeventbus.** -dontwarn com.jeremyliao.liveeventbus.**
-keep class com.jeremyliao.liveeventbus.** { *; } -keep class com.jeremyliao.liveeventbus** { *; }
-keep class okhttp3.**{*;} -keep class okhttp3**{*;}
-keep class okio.**{*;} -keep class okio**{*;}
-keep class com.hwangjr.rxbus.**{*;} -keep class com.hwangjr.rxbus**{*;}
-keep class org.conscrypt.**{*;} -keep class org.conscrypt**{*;}
-keep class com.kunfei.bookshelf.widget.**{*;} -keep class android.support**{*;}
-keep class com.kunfei.bookshelf.bean.**{*;} -keep class me.grantland.widget**{*;}
-keep class android.support.**{*;} -keep class de.hdodenhof.circleimageview**{*;}
-keep class me.grantland.widget.**{*;} -keep class tyrant.explosionfield**{*;}
-keep class de.hdodenhof.circleimageview.**{*;} -keep class tyrantgit.explosionfield**{*;}
-keep class tyrant.explosionfield.**{*;} -keep class freemarker**{*;}
-keep class tyrantgit.explosionfield.**{*;}
-keep class freemarker.**{*;}
-keep class com.gyf.barlibrary.* {*;} -keep class com.gyf.barlibrary.* {*;}
##JSOUP ##JSOUP
-keep class org.jsoup.**{*;} -keep class org.jsoup**{*;}
-keep class **.xpath.**{*;} -keep class **.xpath**{*;}
-keep class org.slf4j.**{*;} -keep class org.slf4j**{*;}
-dontwarn org.slf4j.** -dontwarn org.slf4j.**
-keep class org.codehaus.**{*;} -keep class org.codehaus**{*;}
-dontwarn org.codehaus.** -dontwarn org.codehaus.**
-keep class com.jayway.**{*;} -keep class com.jayway**{*;}
-dontwarn com.jayway.** -dontwarn com.jayway.**
-keep class com.fasterxml.**{*;} -keep class com.fasterxml**{*;}
-keep class javax.swing..**{*;} -keep class javax.swing**{*;}
-dontwarn javax.swing.** -dontwarn javax.swing.**
-keep class java.awt.**{*;} -keep class java.awt**{*;}
-dontwarn java.awt.** -dontwarn java.awt.**
-keep class sun.misc.**{*;} -keep class sun.misc**{*;}
-dontwarn sun.misc.** -dontwarn sun.misc.**
-keep class sun.reflect.**{*;} -keep class sun.reflect**{*;}
-dontwarn sun.reflect.** -dontwarn sun.reflect.**
## Rhino ## Rhino
-keep class javax.script.** { *; } -keep class javax.script** { *; }
-keep class com.sun.script.javascript.** { *; } -keep class com.sun.script.javascript** { *; }
-keep class org.mozilla.javascript.** { *; } -keep class org.mozilla.javascript** { *; }
###EPUB ###EPUB
-dontwarn nl.siegmann.epublib.** -dontwarn nl.siegmann.epublib.**
-dontwarn org.xmlpull.** -dontwarn org.xmlpull.**
-keep class nl.siegmann.epublib.**{*;} -keep class nl.siegmann.epublib**{*;}
-keep class javax.xml.**{*;} -keep class javax.xml**{*;}
-keep class org.xmlpull.**{*;} -keep class org.xmlpull**{*;}
-keep class org.simpleframework.xml.**{*;} -keep class org.simpleframework.xml**{*;}
-dontwarn org.simpleframework.xml.** -dontwarn org.simpleframework.xml.**
-keepclassmembers class * { -keepclassmembers class * {

@ -10,7 +10,7 @@ buildscript {
maven { url 'https://plugins.gradle.org/m2/' } maven { url 'https://plugins.gradle.org/m2/' }
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:3.6.3' classpath 'com.android.tools.build:gradle:4.0.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'de.timfreiheit.resourceplaceholders:placeholders:0.3' classpath 'de.timfreiheit.resourceplaceholders:placeholders:0.3'
classpath 'com.google.gms:google-services:4.3.3' classpath 'com.google.gms:google-services:4.3.3'

@ -1,6 +1,6 @@
#Tue Feb 25 08:10:32 CST 2020 #Sat May 30 10:00:31 CST 2020
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip

Loading…
Cancel
Save