Can't extract icon when apk is built with Android Gradle plugin 4.2
I'm currently trying out the latest beta of Android Studio which features a new JVM resource compiler, enabled by default (and no docs about how to disable it). This seems to change how images are located in the /res
folder of an APK file.
As you can see in this screenshot the typical drawable-*
and mipmap-*
folders are gone but instead file names are obfuscated and directly in the res folder.
So when running fdroid update -c
it can't extract the icons anymore.
I experimented a bit and was able to find the resource ID mapping by first extracting the AndroidManifest.xml
with apkanalyzer
to find the ID of the launcher icon (0x7f0d0000 in my case). Then I dumped the resources with aapt2 dump resources
and could find the mapping in the following section:
type mipmap id=0d entryCount=2
resource 0x7f0d0000 mipmap/ic_launcher
(mdpi) (file) res/u3.png type=PNG
(hdpi) (file) res/SD.png type=PNG
(xhdpi) (file) res/jy.png type=PNG
(xxhdpi) (file) res/D2.png type=PNG
(xxxhdpi) (file) res/CG.png type=PNG
(anydpi-v26) (file) res/uF.xml type=XML
resource 0x7f0d0001 mipmap/ic_launcher_round
(mdpi) (file) res/7c.png type=PNG
(hdpi) (file) res/tf.png type=PNG
(xhdpi) (file) res/1S.png type=PNG
(xxhdpi) (file) res/5Q.png type=PNG
(xxxhdpi) (file) res/C9.png type=PNG
(anydpi-v26) (file) res/oy.xml type=XML
This approach works on older APKs as well so it might be useful to change to this way of finding the application icons (not sure what is currently done to find them).