Configure code shrinking (#200)

This commit is contained in:
Rafał Borcz 2018-12-15 21:29:57 +01:00 committed by Mikołaj Pich
parent 765eac5251
commit 9c94305ba5
6 changed files with 54 additions and 40 deletions

View File

@ -44,7 +44,9 @@ android {
buildTypes { buildTypes {
release { release {
buildConfigField "boolean", "CRASHLYTICS_ENABLED", "true" buildConfigField "boolean", "CRASHLYTICS_ENABLED", "true"
minifyEnabled false minifyEnabled true
useProguard false
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release signingConfig signingConfigs.release
} }
@ -79,7 +81,7 @@ configurations.all {
dependencies { dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
implementation('com.github.wulkanowy:api:88e279e') { exclude module: "threetenbp" } implementation('com.github.wulkanowy:api:afc019d0b7') { exclude module: "threetenbp" }
implementation "androidx.legacy:legacy-support-v4:1.0.0" implementation "androidx.legacy:legacy-support-v4:1.0.0"
implementation "androidx.appcompat:appcompat:1.0.2" implementation "androidx.appcompat:appcompat:1.0.2"
@ -124,10 +126,10 @@ dependencies {
testImplementation "org.mockito:mockito-inline:2.23.4" testImplementation "org.mockito:mockito-inline:2.23.4"
testImplementation 'org.threeten:threetenbp:1.3.8' testImplementation 'org.threeten:threetenbp:1.3.8'
androidTestImplementation 'androidx.test:core:1.0.0' androidTestImplementation 'androidx.test:core:1.1.0'
androidTestImplementation 'androidx.test:runner:1.1.0' androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.ext:junit:1.0.0' androidTestImplementation 'androidx.test.ext:junit:1.1.0'
androidTestImplementation "org.mockito:mockito-android:2.23.4" androidTestImplementation 'org.mockito:mockito-android:2.23.4'
androidTestImplementation "org.jetbrains.kotlin:kotlin-test:$kotlin_version" androidTestImplementation "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
} }

View File

@ -1,25 +1,36 @@
# Add project specific ProGuard rules here. # Optimizations
# By default, the flags in this file are appended to flags specified -optimizationpasses 5
# in C:\Users\RicomenPL\AppData\Local\Android\Sdk/tools/proguard/proguard-android.txt -optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
# You can edit the include path and order by changing the proguardFiles -dontusemixedcaseclassnames
# directive in build.gradle. -dontskipnonpubliclibraryclasses
# -dontskipnonpubliclibraryclassmembers
# For more details, see -dontpreverify
# http://developer.android.com/guide/developing/tools/proguard.html -allowaccessmodification
-repackageclasses ''
-verbose
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following #Config for anallitycs
# and specify the fully qualified class name to the JavaScript interface -keepattributes *Annotation*
# class: -keepattributes SourceFile,LineNumberTable
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -renamesourcefileattribute SourceFile
# public *; -keep class com.crashlytics.** {*;}
#} -keep public class * extends java.lang.Exception
-dontwarn com.crashlytics.**
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to #Config for OkHttp
# hide the original source file name. -keepnames class okhttp3.internal.publicsuffix.PublicSuffixDatabase
#-renamesourcefileattribute SourceFile -dontwarn org.codehaus.mojo.animal_sniffer.*
-dontwarn okhttp3.internal.platform.ConscryptPlatform
-dontwarn javax.annotation.**
#Config for ReactiveNetwork
-dontwarn com.github.pwittchen.reactivenetwork.library.rx2.ReactiveNetwork
-dontwarn io.reactivex.functions.Function
-dontwarn rx.internal.util.**
-dontwarn sun.misc.Unsafe
#Confi for API
-keep class io.github.wulkanowy.api.** {*;}

View File

@ -38,6 +38,7 @@ class AboutFragment : BaseFragment(), AboutView, MainView.TitledView {
.withLicenseShown(true) .withLicenseShown(true)
.withAboutSpecial1(getString(R.string.about_source_code)) .withAboutSpecial1(getString(R.string.about_source_code))
.withAboutSpecial2(getString(R.string.about_feedback)) .withAboutSpecial2(getString(R.string.about_feedback))
.withFields(R.string::class.java.fields)
.withCheckCachedDetection(false) .withCheckCachedDetection(false)
.withExcludedLibraries("fastadapter", "AndroidIconics", "gson", .withExcludedLibraries("fastadapter", "AndroidIconics", "gson",
"Jsoup", "Retrofit", "okio", "OkHttp") "Jsoup", "Retrofit", "okio", "OkHttp")

View File

@ -2,7 +2,7 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:foreground="?attr/colorControlHighlight" android:background="?colorControlHighlight"
android:minHeight="40dp" android:minHeight="40dp"
android:orientation="horizontal" android:orientation="horizontal"
android:paddingLeft="20dp" android:paddingLeft="20dp"

View File

@ -2,7 +2,7 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:foreground="?attr/colorControlHighlight" android:background="?colorControlHighlight"
android:orientation="horizontal" android:orientation="horizontal"
android:paddingLeft="20dp" android:paddingLeft="20dp"
android:paddingTop="7dp" android:paddingTop="7dp"

View File

@ -7,7 +7,7 @@
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:foreground="?attr/colorControlHighlight" android:background="?colorControlHighlight"
android:orientation="horizontal" android:orientation="horizontal"
android:paddingLeft="20dp" android:paddingLeft="20dp"
android:paddingTop="7dp" android:paddingTop="7dp"