ionic-team / capacitor-assets

Local Capacitor icon/splash screen resource generation tool
MIT License
504 stars 99 forks source link

Adaptive icon does not cover default black background #522

Open kamilchlebek opened 1 year ago

kamilchlebek commented 1 year ago

I noticed small issue when trying to setup splash screen on Android >= 12.

Namely there's a little bit of black color on the edges of the icon.

The issue is related with https://github.com/ionic-team/capacitor-assets/pull/424 which added android:inset="16.7%" to the foreground & background. I suppose that due to calculation inaccuracy (1/6 ≈ 16.7%), the background is too small and doesn't cover default background that lies underneath.

Workaround

Change: android:inset="16.7%" to android:inset="16.6%"

Actual (left), Expected (right)

splash

Here's a StackOverflow thread that describes how are icons rendered:

https://stackoverflow.com/a/49869048/9932919

It links to android source that explains where does that black color come from:

https://android.googlesource.com/platform/frameworks/base/+/oreo-release/graphics/java/android/graphics/drawable/AdaptiveIconDrawable.java#351

Dante1349 commented 1 year ago

we have the same issue, generated icons for android are useless

MunizErthal commented 1 year ago

Same here...

killingHail606 commented 11 months ago

Same :)

fernao commented 11 months ago

Same here!

fernao commented 11 months ago

I didn't get the workaround, the inset... I'm using capacitor and I'm experiencing the 1px black line at right and botton of icon. I would like to know how should I update my AndroidManifest.xml with: android:inset="16.6%"

fernao commented 11 months ago

I did the workaround, but have to manually edit while capacitor-assets is not fixed. I've found the android:inset in those two files in a search with grep:

grep -r 'android:inset' android/app/src/main/res

android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:        <inset android:drawable="@mipmap/ic_launcher_background" android:inset="16.7%" />
android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:        <inset android:drawable="@mipmap/ic_launcher_foreground" android:inset="16.7%" />
android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:        <inset android:drawable="@mipmap/ic_launcher_background" android:inset="16.7%" />
android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:        <inset android:drawable="@mipmap/ic_launcher_foreground" android:inset="16.7%" />

So, after the changes to 16.6% it worked!

funkenstrahlen commented 9 months ago

I did the workaround, but have to manually edit while capacitor-assets is not fixed. I've found the android:inset in those two files in a search with grep:

grep -r 'android:inset' android/app/src/main/res

android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:        <inset android:drawable="@mipmap/ic_launcher_background" android:inset="16.7%" />
android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:        <inset android:drawable="@mipmap/ic_launcher_foreground" android:inset="16.7%" />
android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:        <inset android:drawable="@mipmap/ic_launcher_background" android:inset="16.7%" />
android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:        <inset android:drawable="@mipmap/ic_launcher_foreground" android:inset="16.7%" />

So, after the changes to 16.6% it worked!

This worked for me!

lil5 commented 2 months ago

PR #534 will fix this, where are you ionic devs?