'SVG drawables do not show up on some Android 9 devices
In my Android app, I recently migrated from using PNG icons to SVG drawables. This worked well in the Android emulator and works fine on most of our users devices, however, especially Asus phone owners with Android 9 report they don't see the icons (however they can still be clicked on).
Example icon (menu_navigation.xml)
<vector android:height="24dp" android:viewportHeight="16"
android:viewportWidth="16" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillAlpha="0" android:fillColor="#D8D8D8"
android:fillType="evenOdd" android:pathData="M-3,0h19v19h-19z"
android:strokeAlpha="0" android:strokeColor="#00000000" android:strokeWidth="1"/>
<path android:fillColor="#00000000" android:fillType="evenOdd"
android:pathData="M12,11.3333C12,12.0083 11.4528,12.5556 10.7778,12.5556L3.4444,12.5556L1,15L1,5.2222C1,4.5472 1.5472,4 2.2222,4L10.7778,4C11.4528,4 12,4.5472 12,5.2222L12,11.3333Z"
android:strokeColor="#FFFFFF" android:strokeLineCap="round"
android:strokeLineJoin="round" android:strokeWidth="1.5"/>
<path android:fillColor="#F8E71C" android:fillType="evenOdd"
android:pathData="M14.5,1.5m-1.5,0a1.5,1.5 0,1 1,3 0a1.5,1.5 0,1 1,-3 0"
android:strokeColor="#00000000" android:strokeWidth="1"/>
</vector>
Use in BottomNavigationMenu:
<menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto">
...
<item
android:id="@+id/navigation_conversations"
android:icon="@drawable/menu_conversations"
android:checkable="true"
android:checked="true"
app:showAsAction="ifRoom"
android:title="" />
...
</menu>
In Activity:
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_3"
app:itemBackground="@drawable/menu_selector"
app:itemIconTint="@android:color/white"
app:labelVisibilityMode="unlabeled"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:menu="@menu/navigation" />
How the icon should be shown:

(source: kvetinac97.cz)
What the user sees:

(source: kvetinac97.cz)
(Please ignore that order of 2nd and 3rd icon is reversed)
Any idea what could be causing the icon to disappear? Other icons (pngs) show normally.
Solution 1:[1]
The jboss/keycloak images only support linux/amd64 architectures. See the tags inside Docker Hub.
With your M1, you have an arm64 processor that's not supported by the official Keycloak images. With Apple's Rosetta 2 emulation, Apple tries best effort to make an amd64 image work, but your Keycloak container fails during startup:
A fatal error has been detected by the Java Runtime Environment: SIGILL (0x4) at pc=0x0000004016607605, pid=343, tid=466
You can use a community build that supports arm64:
public static KeycloakContainer keycloakContainer =
new KeycloakContainer("mihaibob/keycloak:14.0.0")
.withRealmImportFile("/test_realm.json");
You should also be able to build your own arm64 compatible Keycloak Docker image locally.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | rieckpil |
