From da6d8bdd71af609996550ef31e1fb64085fbab15 Mon Sep 17 00:00:00 2001 From: Tad Date: Thu, 3 May 2018 11:36:29 -0400 Subject: [PATCH] Reduce APK size This reduces release apk size from 1,772,224 bytes to 1,002,180 bytes --- build.gradle | 15 +++++++++++++++ proguard-rules.pro | 25 +++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 proguard-rules.pro diff --git a/build.gradle b/build.gradle index 78f2639..2f4f8ad 100644 --- a/build.gradle +++ b/build.gradle @@ -70,6 +70,21 @@ android { minSdkVersion 9 targetSdkVersion 25 } + + buildTypes { + debug { + minifyEnabled true + zipAlignEnabled true + useProguard false + } + release { + shrinkResources true + minifyEnabled true + zipAlignEnabled true + useProguard true + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } } if (file('user.gradle').exists()) { diff --git a/proguard-rules.pro b/proguard-rules.pro new file mode 100644 index 0000000..f60575a --- /dev/null +++ b/proguard-rules.pro @@ -0,0 +1,25 @@ +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in $ANDROID_HOME/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the proguardFiles +# directive in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# 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 +# hide the original source file name. +#-renamesourcefileattribute SourceFile