Copy link to clipboard
Copied
Since releasing an Android build supporting api level 27 we notice our app icon is displayed smaller and in a white frame on Android 8+ devices, because of this:
Adaptive icons | Android Developers
We can probably work out how to add in the right resources to fix this, but naturally it would be more convenient if the SDK handled it, as well as for apps that don't use inhouse ANEs etc.
Copy link to clipboard
Copied
For anyone who's wondering, this turns out to be not that hard - you can import your foreground and background in Android Studio, rename "ic_launcher" to "icon" wherever it appears as the default name, and then include the files in the res/ folder it produces as android resources - if you're using ANEs, you can package the resources in one of them (if not I guess you can use aapt and resign the apk) and they'll show up in Android 8.
Copy link to clipboard
Copied
Hi ,
what do you mean by "import your foreground and background in Android Studio" ?
Gili
Copy link to clipboard
Copied
instructions here:
Create app icons with Image Asset Studio | Android Developers
you can just create a fake Android Studio project and copy the directories/files it creates.
Copy link to clipboard
Copied
To fix this problem we added adaptive icons manually. And adjusted the jenkins pipeline to resign app after changing content.
It looks like that:
cd $WORKSPACE/build/
rm -rf $WORKSPACE/build/App-release
apktool d App-release.apk
sed -E 's/android:icon="@mipmap\/icon"/android:icon="@mipmap\/ic_launcher" android:roundIcon="@mipmap\/ic_launcher_round"/' App-release/AndroidManifest.xml > App-release/AndroidManifestModified.xml
rm App-release/AndroidManifest.xml
mv App-release/AndroidManifestModified.xml App-release/AndroidManifest.xml
sed -E 's/<\/resources>/ <color name="ic_launcher_background">#ff005878<\/color>\'$'\n''<\/resources>/' App-release/res/values/colors.xml > App-release/res/values/colorsModified.xml
rm App-release/res/values/colors.xml
mv App-release/res/values/colorsModified.xml App-release/res/values/colors.xml
cp -R ../manual_content/android_res/res/* App-release/res/
apktool b App-release
jarsigner -verbose -keystore ../cert/android_release.p12 -storetype pkcs12 -storepass PAS$WORD App-release/dist/App-release.apk "ALIAS NAME FOR KEY"
jarsigner -verify App-release/dist/App-release.apk
../tools/android-sdk-macosx/build-tools/24.0.3/zipalign -v 4 App-release/dist/App-release.apk App-release/dist/App-release-resigned.apk
rm App-release.apk
cp App-release/dist/App-release-resigned.apk App-release.apk
In res folder we store
mipmap-anydpi-v26 with two xml files created from Android Studio Asset creator
mipmap-hdpi with three files ic_launcher_foreground.png, ic_launcher_round.png, ic_launcher.png
mipmap-mdpi with same files but different size
and so on
mipmap-xhdpi
mipmap-xxhdpi
mipmap-xxxhdpi
Copy link to clipboard
Copied
someone in the starling forums is reporting an even easier way: