Skip to main content
Inspiring
June 14, 2018
Question

Android 8.0 adaptive icons support

  • June 14, 2018
  • 2 replies
  • 2648 views

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.

This topic has been closed for replies.

2 replies

Participating Frequently
September 3, 2018

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

Inspiring
November 20, 2018

someone in the starling forums is reporting an even easier way:

Adaptive icons for Android « Starling Forum

Inspiring
June 15, 2018

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.

giladl36147141
Participant
July 3, 2018

Hi ,

what do you mean by "import your foreground and background in Android Studio" ?

Gili

Inspiring
July 5, 2018

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.