Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Icongenie: Android icons aren't properly generated following adaptive icons guidelines #17045

Open
IlCallo opened this issue Mar 27, 2024 · 0 comments
Labels

Comments

@IlCallo
Copy link
Member

IlCallo commented Mar 27, 2024

What happened?

In a Quasar project using Capacitor and supporting Android, I generate the required icons via icongenie
The resulting icons looked nice when viewed by themselves, but when opening src-capacitor/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml the preview looked wrong, and displayed icons after installing the app them were too

Seems like this is a problem with the new Adaptive Icons used by newer Android versions

Images of generated splashscreens and icons
image
image

Image of how the launcher preview and how it actually looked when installed
image

What did you expect to happen?

Icongenie to correctly generate the icons

Reproduction URL

https://stackblitz.com/edit/quasarframework-mgd9kd

How to reproduce?

  1. Generate a Quasar project
  2. Add Capacitor mode
  3. Execute pnpm dlx @quasar/icongenie g -i src/assets/favicon.png
  4. Open src-capacitor/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml in Android Studio and check out the preview

StackBlitz apparently won't support running npx @quasar/icongenie, so it wasn't able to generate the icons as explained here

Flavour

Quasar CLI with Vite (@quasar/cli | @quasar/app-vite)

Areas

Icon Genie CLI (@quasar/icongenie), Capacitor Mode

Platforms/Browsers

Android

Quasar info output

No response

Relevant log output

No response

Additional context

The problem here could be either in Capacitor scaffolded templates for Android AND/OR Icongenie generation

Possibly it could be fixed by re-generating files from Android Studio and updating Capacitor mode template files

It seems like this is related to latest icon specs changes, in particular about Adaptive Icons, or Android 13/14 new files: https://developer.android.com/develop/ui/views/launch/icon_design_adaptive

I initially workaround the problem by using this trick: https://stackoverflow.com/questions/69147332/android-adaptive-icon-foreground-always-too-big

Changing

<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
    <background android:drawable="@color/ic_launcher_background"/>
    <foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>

into

<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
    <background android:drawable="@color/ic_launcher_background"/>
    <foreground>
      <inset android:drawable="@mipmap/ic_launcher_foreground" android:inset="20%" />
    </foreground>
</adaptive-icon>

but results were suboptimal

Then I resorted in using Android Studio own Image Asset Studio as explained here: https://developer.android.com/studio/write/create-app-icons#create-adaptive

That re-generated many files in my project, especially ic_launcher_background.xml and this line into ic_launcher.xml and ic_launcher_round.xml

- <background android:drawable="@color/ic_launcher_background"/>
+ <background android:drawable="@drawable/ic_launcher_background"/>

Some more resources:

@IlCallo IlCallo added kind/bug 🐞 Qv2 🔝 Quasar v2 issues labels Mar 27, 2024
@github-actions github-actions bot added area/icongenie bug/1-repro-available A reproduction is available and needs to be confirmed. flavour/quasar-cli-vite mode/capacitor labels Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant