UI can't extract app icon when android.enableResourceOptimizations is enabled (default value)
Problem:
- If I add a APK file to a repository, repomaker is unable to extract the icon. Repomaker will only show a placeholder.
Effects:
- The UI of repomaker
- Maybe the F-Droid client when adding the repository (with the app with the broken icon). But I'm unsure - maybe this is caused by my faulty upload the F-Droid because the official F-Droid app page has no icon either (https://f-droid.org/en/packages/de.marmaro.krt.ffupdater/)
Possible reason for the bug:
- It seems that repomaker is unzipping the APK file and searches for the icon file in
res/mipmap-xxxhdpi-v4/ic_launcher.png
.
Examples for this bug:
- A different app (https://github.com/kiwibrowser/) is also affected by this bug and it stores the icon file in
res/mipmap-xxxhdpi-v4/app_icon.png
- My debug build is NOT effected. The icon file is stored in
res/mipmap-xxxhdpi-v4/ic_launcher.png
. - My release build is effected. The icon file is stored in
res/CG.png
.
Temporary solution:
- Add
android.enableResourceOptimizations=false
to the gradle.propoperties. This will prevent the renaming of resources files in the APK file. But this option is deprecated and will be remove in the android gradle plugin 8.0. - But this will increase the APK size (in my case from 5 to 6.5 MB)
Real solution:
- Repomaker should decompile the AndroidManifest.xml and look up the id for android:icon (e.g.
@ref/0x7f0e0000
) - The resources.arsc should be decompiled and Repomaker should look up the file path for the id
I know that little work is currently being done on the project. This bug report is intended for the next users so that they do not spend hours looking for the solution.