diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 9a70b32560..912a9bc5f9 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -1,4 +1,5 @@ // START Non-FOSS component +import com.google.firebase.crashlytics.buildtools.gradle.CrashlyticsExtension import com.google.firebase.crashlytics.buildtools.gradle.CrashlyticsPlugin // END Non-FOSS component import com.google.gms.googleservices.GoogleServicesPlugin @@ -73,12 +74,17 @@ android { } } release { - isMinifyEnabled = true - isShrinkResources = true - proguardFiles( - getDefaultProguardFile("proguard-android-optimize.txt"), - "proguard-rules.pro", - ) + optimization { + enable = true + } + // START Non-FOSS component + if (project.file("google-services.json").exists()) { + configure { + // Crashlytics 3.0.8 still detects the legacy minify flag. + mappingFileUploadEnabled = true + } + } + // END Non-FOSS component if (hasSigningProps) { signingConfig = signingConfigs.getByName("flare") } else { @@ -245,4 +251,3 @@ kotlin { } } } - diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro deleted file mode 100644 index a01abe7e78..0000000000 --- a/app/proguard-rules.pro +++ /dev/null @@ -1,93 +0,0 @@ -# Add project specific ProGuard rules here. -# You can control the set of applied configuration files using the -# proguardFiles setting in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# 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 - -# When editing this file, update the following files as well: -# - META-INF/com.android.tools/proguard/coroutines.pro -# - META-INF/com.android.tools/r8/coroutines.pro - -# ServiceLoader support --keepnames class kotlinx.coroutines.internal.MainDispatcherFactory {} --keepnames class kotlinx.coroutines.CoroutineExceptionHandler {} - -# Most of volatile fields are updated with AFU and should not be mangled --keepclassmembers class kotlinx.coroutines.** { - volatile ; -} - -# Same story for the standard library's SafeContinuation that also uses AtomicReferenceFieldUpdater --keepclassmembers class kotlin.coroutines.SafeContinuation { - volatile ; -} - -# These classes are only required by kotlinx.coroutines.debug.AgentPremain, which is only loaded when -# kotlinx-coroutines-core is used as a Java agent, so these are not needed in contexts where ProGuard is used. --dontwarn java.lang.instrument.ClassFileTransformer --dontwarn sun.misc.SignalHandler --dontwarn java.lang.instrument.Instrumentation --dontwarn sun.misc.Signal - -# Only used in `kotlinx.coroutines.internal.ExceptionsConstructor`. -# The case when it is not available is hidden in a `try`-`catch`, as well as a check for Android. --dontwarn java.lang.ClassValue - -# An annotation used for build tooling, won't be directly accessed. --dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement - -# 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. --adaptresourcefilenames okhttp3/internal/publicsuffix/PublicSuffixDatabase.gz - -# 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 and other security providers are available. --dontwarn okhttp3.internal.platform.** --dontwarn org.conscrypt.** --dontwarn org.bouncycastle.** --dontwarn org.openjsse.** - --dontwarn org.slf4j.impl.StaticLoggerBinder - --if class androidx.credentials.CredentialManager --keep class androidx.credentials.playservices.** { - *; -} --keepnames class ** { *; } - -# for JNA --keep class com.sun.jna.* { *; } --keepclassmembers class * extends com.sun.jna.* { public *; } - -# UniFFI/JNA generated bindings for nostr-sdk-kmp live under rust.nostr.sdk. -# The upstream consumer rules only keep rust.nostr.*, which misses the actual -# Android package and lets R8 rewrite the JNA interfaces used by Native.load(). --keep class rust.nostr.sdk.** { *; } --keep interface rust.nostr.sdk.** { *; } --keepclassmembers class rust.nostr.sdk.** { *; } --keepclassmembers interface rust.nostr.sdk.** { *; } --dontwarn java.lang.management.** --dontwarn javax.management.** --assumevalues public class androidx.compose.runtime.ComposeRuntimeFlags { - static boolean isLinkBufferComposerEnabled return true; -} \ No newline at end of file diff --git a/app/src/main/keepRules/app.keep b/app/src/main/keepRules/app.keep new file mode 100644 index 0000000000..84da1518ed --- /dev/null +++ b/app/src/main/keepRules/app.keep @@ -0,0 +1,22 @@ +# Temporary compatibility workaround for Ktorfit 2.7.5. +# ktorfit-lib-light-android omits the rule bundled in the JVM artifact, which +# allows R8 to break the generic type data consumed by response converters. +# Re-evaluate after upgrading to an Android artifact that bundles the rule. +-keep class de.jensklingenberg.ktorfit.** { *; } + +# Temporary compatibility workaround for nostr-sdk-kmp 0.44.8. +# Its published Android consumer rule targets rust.nostr.*, while the generated +# UniFFI/JNA bindings are in rust.nostr.sdk. Re-evaluate after upgrading it or +# validating that the narrower JNA boundary rules are sufficient in release. +-keep class rust.nostr.sdk.** { *; } + +# Optional JVM management APIs are not available on Android. Keep these +# suppressions until a clean optimized release succeeds without them. +-dontwarn java.lang.management.** +-dontwarn javax.management.** + +# Intentional optimizer assumption: force link-buffer composer on in release. +# Remove this rule if the project should follow Compose runtime's default. +-assumevalues public class androidx.compose.runtime.ComposeRuntimeFlags { + static boolean isLinkBufferComposerEnabled return true; +} diff --git a/build-logic/build.gradle.kts b/build-logic/build.gradle.kts index 95845735f6..f4350e8c15 100644 --- a/build-logic/build.gradle.kts +++ b/build-logic/build.gradle.kts @@ -10,7 +10,7 @@ repositories { } dependencies { - compileOnly("com.android.tools.build:gradle:9.3.1") + compileOnly("com.android.tools.build:gradle:9.3.2") compileOnly("org.jetbrains.kotlin:kotlin-gradle-plugin:2.4.10") implementation("org.jlleitschuh.gradle:ktlint-gradle:14.2.0") }