You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
I have the following code to fetch and render adaptive icons, specifically the res/mipmap-anydpi-v26/ic_launcher.xml file.
@Composable
fun adaptiveIconPainterResource(@DrawableRes id: Int): Painter {
val res = LocalContext.current.resources
val theme = LocalContext.current.theme
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
// Android O supports adaptive icons, try loading this first (even though this is least likely to be the format).
val adaptiveIcon = ResourcesCompat.getDrawable(res, id, theme) as? AdaptiveIconDrawable
if (adaptiveIcon != null) {
BitmapPainter(adaptiveIcon.toBitmap().asImageBitmap())
} else {
// We couldn't load the drawable as an Adaptive Icon, just use painterResource
painterResource(id)
}
} else {
// We're not on Android O or later, just use painterResource
painterResource(id)
}
}
This code work fine in the running app, and fine in the Android Studio preview, but fails with the following error in Paparazzi.
SEVERE: null: Failed to parse file /Users/andy/Development/mx51/vaa-android/x-paparazzi-tests/../core/ui/build/intermediates/packaged_res/geckoBankDebug/mipmap-anydpi-v26/ic_launcher.xml
java.lang.IllegalArgumentException: Path string can not be null.
at android.util.PathParser.createPathFromPathData(PathParser.java:36)
at android.graphics.drawable.AdaptiveIconDrawable.<init>(AdaptiveIconDrawable.java:167)
at android.graphics.drawable.AdaptiveIconDrawable.<init>(AdaptiveIconDrawable.java:151)
at android.graphics.drawable.DrawableInflater.inflateFromTag(DrawableInflater.java:161)
at android.graphics.drawable.DrawableInflater.inflateFromXmlForDensity(DrawableInflater.java:136)
at android.graphics.drawable.Drawable.createFromXmlInnerForDensity(Drawable.java:1394)
at android.graphics.drawable.Drawable.createFromXmlForDensity(Drawable.java:1355)
at android.graphics.drawable.Drawable.createFromXml(Drawable.java:1330)
at com.android.layoutlib.bridge.impl.ResourceHelper.getDrawable(ResourceHelper.java:393)
at android.content.res.Resources_Delegate.getDrawable(Resources_Delegate.java:184)
at android.content.res.Resources.getDrawable(Resources.java:931)
at androidx.core.content.res.ResourcesCompat$Api21Impl.getDrawable(ResourcesCompat.java:705)
at androidx.core.content.res.ResourcesCompat.getDrawable(ResourcesCompat.java:137)
at io.mx51.vaa.ui.composables.PainterResourceExtKt.adaptiveIconPainterResource(PainterResourceExt.kt:22)
at io.mx51.vaa.ui.settings.ManageSpaceScreenKt.ManageSpaceView(ManageSpaceScreen.kt:68)
Steps to Reproduce
Create a new Compose project with default icons in Android Studio.
Create a new Composable screen and use the method above to display the launcher icon on the screen.
Note that the screen renders fine in Android Studio and when run on a phone (Android O or later).
Record the paparazzi tests and note that the screen doesn't show the icon.
Expected behavior
The adaptive icon for the launcher icon of my app should be rendered correctly using the code above.
Additional information:
Paparazzi Version: 1.3.1
OS: Mac
Compile SDK: 33
Gradle Version: 8.1
Android Gradle Plugin Version: 8.0.2
Screenshots
Paparazzi Test
vs
Android Studio Preview
The text was updated successfully, but these errors were encountered:
I'm seeing this too on 1.3.2 and 1.3.3. I'm struggling to deal with this on 1.3.3 because even if I handle the exception the test fails as exceptions were logged. Is there an expected fix date or version for this?
Value taken from $ANDROID_HOME/platforms/android-35/data/res/values/config.xml!string/config_icon_mask.
It's used either in com.android.layoutlib.brige.impl.RenderAction or android.graphics.drawable.AdaptiveIconLayout depending on the version of layoutlib.
Description
I have the following code to fetch and render adaptive icons, specifically the
res/mipmap-anydpi-v26/ic_launcher.xml
file.This code work fine in the running app, and fine in the Android Studio preview, but fails with the following error in Paparazzi.
Steps to Reproduce
Expected behavior
The adaptive icon for the launcher icon of my app should be rendered correctly using the code above.
Additional information:
Screenshots


Paparazzi Test
vs
Android Studio Preview
The text was updated successfully, but these errors were encountered: