Issue
I'm working on an Android app (written in Flutter but I don't think it matters) which uses a drawable called quick_plus.png
as shown here:
It works great in debug mode.
But not in release mode, where the quick_plus.png
drawable became a black square. After unzipping my APKs I confirmed that's also what they contained, just a black square:
No idea if this is relevant, but I generated those APKs by following the bundletool docs:
bundletool build-apks \
--bundle=build/app/outputs/bundle/release/app-release.aab \
--output=build/app/outputs/bundle/release/app-release.apks \
--ks=... \
--ks-pass=... \
--ks-key-alias=... \
--key-pass=...
bundletool install-apks --apks=build/app/outputs/bundle/release/app-release.apks
Here's my build.gradle
release config:
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
signingConfig signingConfigs.release
minifyEnabled true
useProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
and the proguard-rules.pro
:
#Flutter Wrapper
-keep class io.flutter.app.** { *; }
-keep class io.flutter.plugin.** { *; }
-keep class io.flutter.util.** { *; }
-keep class io.flutter.view.** { *; }
-keep class io.flutter.** { *; }
-keep class io.flutter.plugins.** { *; }
-keep class com.dexterous.** { *; }
Has anyone seen this before?
Solution
Found the problem!
It was due to Android shrinking and obfuscating my code. All I had to do was add a file called android/app/src/main/res/raw/keep.xml
with this:
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools"
tools:keep="@drawable/quick_plus" />
Answered By - J. V.
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.