mirror of
https://github.com/ImranR98/Obtainium.git
synced 2026-07-30 17:06:26 -04:00
Fix release build: add androidx.window R8 keep rules, wire proguard-rules.pro
This Flutter SDK's Gradle plugin enables R8 release minification by default (FlutterPluginUtils.shouldShrinkResources() returns true), so release builds run minifyReleaseWithR8. R8 then fails on the optional androidx.window.extensions/sidecar classes - compile-time-only stubs referenced by the transitive androidx.window dependency and provided by the OEM at runtime. - proguard-rules.pro: -dontwarn androidx.window.extensions/sidecar (per R8's own missing_rules.txt) - build.gradle.kts: make isMinifyEnabled/isShrinkResources explicit and add proguardFiles so proguard-rules.pro is actually applied (it was never referenced before, leaving its rules dormant)
This commit is contained in:
@@ -77,6 +77,12 @@ android {
|
||||
|
||||
buildTypes {
|
||||
getByName("release") {
|
||||
isMinifyEnabled = true
|
||||
isShrinkResources = true
|
||||
proguardFiles(
|
||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||
"proguard-rules.pro",
|
||||
)
|
||||
val releaseSigningConfig = signingConfigs.getByName("release")
|
||||
signingConfig = if (keystorePropertiesExists && releaseSigningConfig.storeFile != null) {
|
||||
releaseSigningConfig
|
||||
|
||||
13
android/app/proguard-rules.pro
vendored
13
android/app/proguard-rules.pro
vendored
@@ -29,4 +29,15 @@
|
||||
-keep,allowobfuscation,allowshrinking class com.google.gson.reflect.TypeToken
|
||||
-keep,allowobfuscation,allowshrinking class * extends com.google.gson.reflect.TypeToken
|
||||
|
||||
##---------------End: proguard configuration for Gson ----------
|
||||
##---------------End: proguard configuration for Gson ----------
|
||||
|
||||
##---------------Begin: androidx.window ----------
|
||||
# androidx.window (pulled in transitively, e.g. via the Flutter embedding / WebView)
|
||||
# references optional OEM-provided window-management extension and sidecar classes
|
||||
# reflectively. They are not present at compile time, so R8 flags them as missing.
|
||||
# Suppressing is safe: the classes are supplied by the device at runtime (or absent,
|
||||
# in which case the library gracefully falls back). See missing_rules.txt generated by
|
||||
# R8 at build/app/outputs/mapping/normalRelease/missing_rules.txt.
|
||||
-dontwarn androidx.window.extensions.**
|
||||
-dontwarn androidx.window.sidecar.**
|
||||
##---------------End: androidx.window ----------
|
||||
Reference in New Issue
Block a user