Updated Gradle and Gradle plugin versions. Enabled artifact minification and resource shrinking (reduces APK size by more than 50%).

This commit is contained in:
Antoine POPINEAU 2020-06-25 22:29:33 +02:00
parent 9c61fcf462
commit 921154edbb
No known key found for this signature in database
GPG Key ID: A78AC64694F84063
5 changed files with 25 additions and 17 deletions

View File

@ -1,5 +1,3 @@
import org.gradle.kotlin.dsl.*
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmOptions
import org.jetbrains.kotlin.konan.properties.hasProperty import org.jetbrains.kotlin.konan.properties.hasProperty
import java.io.FileInputStream import java.io.FileInputStream
import java.util.* import java.util.*
@ -15,7 +13,10 @@ plugins {
} }
val props = Properties().apply { val props = Properties().apply {
try { load(FileInputStream(rootProject.file("local.properties"))) } catch (e: Exception) {} try {
load(FileInputStream(rootProject.file("local.properties")))
} catch (e: Exception) {
}
} }
androidGitVersion { androidGitVersion {
@ -30,9 +31,7 @@ android {
} }
kotlinOptions { kotlinOptions {
(this as KotlinJvmOptions).apply { jvmTarget = JavaVersion.VERSION_1_8.toString()
jvmTarget = JavaVersion.VERSION_1_8.toString()
}
} }
buildToolsVersion = "29.0.3" buildToolsVersion = "29.0.3"
@ -64,6 +63,10 @@ android {
buildTypes { buildTypes {
getByName("debug") { getByName("debug") {
isDebuggable = true isDebuggable = true
resValue("string", "debug.hostname", props.getProperty("debug.hostname", ""))
resValue("string", "debug.username", props.getProperty("debug.username", ""))
resValue("string", "debug.password", props.getProperty("debug.password", ""))
} }
getByName("release") { getByName("release") {
@ -71,10 +74,13 @@ android {
signingConfig = signingConfigs.getByName("release") signingConfig = signingConfigs.getByName("release")
} }
isMinifyEnabled = false isMinifyEnabled = true
isShrinkResources = true
proguardFile(getDefaultProguardFile("proguard-android-optimize.txt")) proguardFiles(
proguardFile("proguard-rules.pro") getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
} }
} }
} }
@ -97,9 +103,9 @@ play {
dependencies { dependencies {
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar", "*.aar")))) implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar", "*.aar"))))
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.71") implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.6") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.7")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.6") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.7")
implementation("androidx.appcompat:appcompat:1.1.0") implementation("androidx.appcompat:appcompat:1.1.0")
implementation("androidx.core:core-ktx:1.5.0-alpha01") implementation("androidx.core:core-ktx:1.5.0-alpha01")
@ -107,7 +113,7 @@ dependencies {
implementation("androidx.coordinatorlayout:coordinatorlayout:1.1.0") implementation("androidx.coordinatorlayout:coordinatorlayout:1.1.0")
implementation("androidx.preference:preference:1.1.1") implementation("androidx.preference:preference:1.1.1")
implementation("androidx.recyclerview:recyclerview:1.1.0") implementation("androidx.recyclerview:recyclerview:1.1.0")
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.0.0") implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.1.0")
implementation("com.google.android.material:material:1.3.0-alpha01") implementation("com.google.android.material:material:1.3.0-alpha01")
implementation("com.android.support.constraint:constraint-layout:1.1.3") implementation("com.android.support.constraint:constraint-layout:1.1.3")

View File

@ -0,0 +1 @@
-keep class com.github.apognu.otter.** { *; }

View File

@ -5,8 +5,8 @@ buildscript {
} }
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:1.3.50") classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.72")
} }
} }

View File

@ -1,5 +1,6 @@
org.gradle.jvmargs=-Xmx1536m org.gradle.jvmargs=-Xmx1536m
kotlin.code.style=official
android.useAndroidX=true android.useAndroidX=true
android.enableJetifier=true android.enableJetifier=true
kotlin.code.style=official

View File

@ -3,4 +3,4 @@ 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