From 5465dcaa4432aa26c028b77eb4b3e6b69a1d2f65 Mon Sep 17 00:00:00 2001 From: Severiano Jaramillo Date: Mon, 11 Feb 2019 15:21:24 -0600 Subject: [PATCH] Enable proguard's minify and fix warnings to be able to create the apks. --- app/build.gradle | 5 +--- app/proguard-rules.pro | 58 +++++++++++++++++++++++++++++++++++++----- build.gradle | 6 ++--- 3 files changed, 56 insertions(+), 13 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 0e17e8d..3f4e010 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -28,15 +28,12 @@ android { } buildTypes { release { - // TODO Fix minify issues and enable again - minifyEnabled false - shrinkResources false + minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' // enable crashlytics ext.enableCrashlytics = true } debug { - // TODO enabling minify breaks the debugger breakpoints, find a way to fix it and enable minify again minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' resValue("string", "PORT_NUMBER", "8082") diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index ab4af9b..524a63c 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -20,13 +20,59 @@ # hide the original source file name. #-renamesourcefileattribute SourceFile --dontwarn sun.misc.Unsafe --dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement --dontwarn org.bitcoinj.store** --dontwarn org.slf4j.** --dontwarn okhttp3.internal.platform.* +###### itextpdf & opencsv +-dontwarn java.awt.** +-dontwarn javax.security.** +-dontwarn java.beans.** -# Firabase Crashlytics +-dontwarn com.itextpdf.awt.** +-dontwarn javax.imageio.** + +-keep class org.bouncycastle.** +-dontwarn org.bouncycastle.** + +-keep class org.spongycastle.** { *; } +-dontwarn org.spongycastle.** + +-keep class javax.xml.crypto.dsig.** { *; } +-dontwarn javax.xml.crypto.dsig.** + +-keep class org.apache.jcp.xml.dsig.internal.dom.** { *; } +-dontwarn org.apache.jcp.xml.dsig.internal.dom.** + +-keep class javax.xml.crypto.dom.** { *; } +-dontwarn javax.xml.crypto.dom.** + +-keep class org.apache.xml.security.utils.** { *; } +-dontwarn org.apache.xml.security.utils.** + +-keep class javax.xml.crypto.XMLStructure +-dontwarn javax.xml.crypto.XMLStructure + + +###### OkHttp +# JSR 305 annotations are for embedding nullability information. +-dontwarn javax.annotation.** + +# A resource is loaded with a relative path so the package of this class must be preserved. +-keepnames class okhttp3.internal.publicsuffix.PublicSuffixDatabase + +# Animal Sniffer compileOnly dependency to ensure APIs are compatible with older versions of Java. +-dontwarn org.codehaus.mojo.animal_sniffer.* + +# OkHttp platform used only on JVM and when Conscrypt dependency is available. +-dontwarn okhttp3.internal.platform.ConscryptPlatform + + +###### bitcoinj +-dontwarn org.bitcoinj.store** + + +###### ??? +-dontwarn org.slf4j.** + + +###### Firabase Crashlytics -keepattributes *Annotation* -keepattributes SourceFile,LineNumberTable -keep public class * extends java.lang.Exception \ No newline at end of file diff --git a/build.gradle b/build.gradle index 3a52512..ac29d60 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,7 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { - ext.kotlin_version = '1.3.20' + ext.kotlin_version = '1.3.21' ext.nav_version = '1.0.0-beta01' repositories { google() @@ -12,11 +12,11 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:3.3.0' + classpath 'com.android.tools.build:gradle:3.3.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "android.arch.navigation:navigation-safe-args-gradle-plugin:$nav_version" classpath 'com.google.gms:google-services:4.2.0' - classpath 'io.fabric.tools:gradle:1.27.0' + classpath 'io.fabric.tools:gradle:1.27.1' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files