[#23] Minify release builds
This commit is contained in:
parent
72c6628649
commit
f0d9c6d398
|
@ -36,5 +36,6 @@ If you plan to fork the project to create a new app of your own, please make the
|
||||||
1. Test coverage for Compose code will be low, due to [known limitations](https://github.com/jacoco/jacoco/issues/1208) in the interaction between Compose and Jacoco.
|
1. Test coverage for Compose code will be low, due to [known limitations](https://github.com/jacoco/jacoco/issues/1208) in the interaction between Compose and Jacoco.
|
||||||
1. Adding the `espresso-contrib` dependency will cause builds to fail, due to conflicting classes. This is a [known issue](https://github.com/zcash/zcash-android-wallet-sdk/issues/306) with the Zcash Android SDK.
|
1. Adding the `espresso-contrib` dependency will cause builds to fail, due to conflicting classes. This is a [known issue](https://github.com/zcash/zcash-android-wallet-sdk/issues/306) with the Zcash Android SDK.
|
||||||
1. Android Studio will warn about the Gradle checksum. This is a [known issue](https://github.com/gradle/gradle/issues/9361) and can be safely ignored.
|
1. Android Studio will warn about the Gradle checksum. This is a [known issue](https://github.com/gradle/gradle/issues/9361) and can be safely ignored.
|
||||||
|
1. [#96](https://github.com/zcash/secant-android-wallet/issues/96) - Release builds print some R8 warnings which can be safely ignored.
|
||||||
1. During app first launch, the following exception starting with `AndroidKeysetManager: keyset not found, will generate a new one` is printed twice. This exception is not an error, and the code is not being invoked twice.
|
1. During app first launch, the following exception starting with `AndroidKeysetManager: keyset not found, will generate a new one` is printed twice. This exception is not an error, and the code is not being invoked twice.
|
||||||
1. The task `ktlintFormat` fails on Java 16 or greater. As a workaround, the task is run under Java 11. This requires that JDK 11 be installed, even if a newer JDK is also installed. While this is configured to use the Java toolchain API, [toolchain support for Java 11 does not work on Apple Silicon](https://github.com/gradle/gradle/issues/19140). [Azul Zulu](https://www.azul.com/downloads/?os=macos&architecture=arm-64-bit&package=jdk) does offer JDK 11, which must be installed manually to run this task from the command line on Apple Silicon.
|
1. The task `ktlintFormat` fails on Java 16 or greater. As a workaround, the task is run under Java 11. This requires that JDK 11 be installed, even if a newer JDK is also installed. While this is configured to use the Java toolchain API, [toolchain support for Java 11 does not work on Apple Silicon](https://github.com/gradle/gradle/issues/19140). [Azul Zulu](https://www.azul.com/downloads/?os=macos&architecture=arm-64-bit&package=jdk) does offer JDK 11, which must be installed manually to run this task from the command line on Apple Silicon.
|
|
@ -43,11 +43,10 @@ android {
|
||||||
buildTypes {
|
buildTypes {
|
||||||
getByName("release").apply {
|
getByName("release").apply {
|
||||||
isMinifyEnabled = project.property("IS_MINIFY_ENABLED").toString().toBoolean()
|
isMinifyEnabled = project.property("IS_MINIFY_ENABLED").toString().toBoolean()
|
||||||
proguardFiles.addAll(
|
isShrinkResources = project.property("IS_MINIFY_ENABLED").toString().toBoolean()
|
||||||
listOf(
|
proguardFiles(
|
||||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||||
File("proguard-project.txt")
|
"proguard-project.txt"
|
||||||
)
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -81,6 +80,32 @@ android {
|
||||||
jvmTarget = libs.versions.java.get()
|
jvmTarget = libs.versions.java.get()
|
||||||
allWarningsAsErrors = project.property("IS_TREAT_WARNINGS_AS_ERRORS").toString().toBoolean()
|
allWarningsAsErrors = project.property("IS_TREAT_WARNINGS_AS_ERRORS").toString().toBoolean()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
packagingOptions {
|
||||||
|
resources.excludes.addAll(
|
||||||
|
listOf(
|
||||||
|
"**/*.kotlin_metadata",
|
||||||
|
".readme",
|
||||||
|
"build-data.properties",
|
||||||
|
"META-INF/*.kotlin_module",
|
||||||
|
"META-INF/android.arch**",
|
||||||
|
"META-INF/androidx**",
|
||||||
|
"META-INF/com.android**",
|
||||||
|
"META-INF/com.google.android.material_material.version",
|
||||||
|
"META-INF/com.google.dagger_dagger.version",
|
||||||
|
"META-INF/services/org.jetbrains.kotlin.compiler.plugin.CommandLineProcessor",
|
||||||
|
"META-INF/services/org.jetbrains.kotlin.compiler.plugin.ComponentRegistrar",
|
||||||
|
"META-INF/services/org.jetbrains.kotlin.diagnostics.rendering.DefaultErrorMessages\$Extension",
|
||||||
|
"firebase-**.properties",
|
||||||
|
"kotlin/**",
|
||||||
|
"play-services-**.properties",
|
||||||
|
"protolite-well-known-types.properties",
|
||||||
|
"transport-api.properties",
|
||||||
|
"transport-backend-cct.properties",
|
||||||
|
"transport-runtime.properties",
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
# This improves obfuscation.
|
# Commenting this out would improve obfuscation. The wallet is already open source so obfuscation doesn't provide much benefit
|
||||||
-repackageclasses 'cash.z.ecc.android'
|
# and makes analyzing the release build of the app more difficult.
|
||||||
|
-dontobfuscate
|
||||||
|
|
||||||
# Ensure that stacktraces are reversible.
|
# Ensure that stacktraces are reversible.
|
||||||
-renamesourcefileattribute SourceFile
|
-renamesourcefileattribute SourceFile
|
||||||
|
@ -7,3 +8,10 @@
|
||||||
|
|
||||||
# Generate the combined proguard configuration for debugging.
|
# Generate the combined proguard configuration for debugging.
|
||||||
-printconfiguration build/outputs/proguard-config.txt
|
-printconfiguration build/outputs/proguard-config.txt
|
||||||
|
|
||||||
|
-dontwarn javax.naming.NamingEnumeration
|
||||||
|
-dontwarn javax.naming.NamingException
|
||||||
|
-dontwarn javax.naming.directory.Attribute
|
||||||
|
-dontwarn javax.naming.directory.Attributes
|
||||||
|
-dontwarn javax.naming.directory.DirContext
|
||||||
|
-dontwarn javax.naming.directory.InitialDirContext
|
||||||
|
|
|
@ -10,9 +10,8 @@ To get set up for development, there are several steps that you need to go throu
|
||||||
|
|
||||||
Start by making sure the command line with Gradle works first, because **all the Android Studio run configurations use Gradle internally.** The run configurations are not magic—they map directly to command line invocations with different arguments.
|
Start by making sure the command line with Gradle works first, because **all the Android Studio run configurations use Gradle internally.** The run configurations are not magic—they map directly to command line invocations with different arguments.
|
||||||
|
|
||||||
1. Install Java
|
1. Configure Java
|
||||||
1. Java 16 is currently recommended. Java 11 is the minimum requirement for Android Studio.
|
1. Java 16 is currently recommended. Java 11 is the minimum requirement for Android Studio.
|
||||||
1. To simplify installation, use [Oracle's JDK](https://www.oracle.com/java/technologies/javase-jdk16-downloads.html) installer that will place the Java installation in the right place
|
|
||||||
1. Install Android Studio and the Android SDK
|
1. Install Android Studio and the Android SDK
|
||||||
1. Download the [Android Studio Bumblebee Canary](https://developer.android.com/studio/preview) (we're using the Canary version, due to its improved integration with Jetpack Compose)
|
1. Download the [Android Studio Bumblebee Canary](https://developer.android.com/studio/preview) (we're using the Canary version, due to its improved integration with Jetpack Compose)
|
||||||
1. TODO: Fill in step-by-step instructions for setting up a new environment and installing the Android SDK from within Android Studio
|
1. TODO: Fill in step-by-step instructions for setting up a new environment and installing the Android SDK from within Android Studio
|
||||||
|
|
Loading…
Reference in New Issue