Status Update
Comments
mi...@sharesies.co.nz <mi...@sharesies.co.nz> #2
sh...@gmail.com <sh...@gmail.com> #3
sh...@gmail.com <sh...@gmail.com> #4
```kotlin
placeholder.xml
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="
android:height="200dp"
android:viewportHeight="200"
android:viewportWidth="125"
android:width="125dp">
<path
android:fillColor="@color/black"
android:pathData="M 0,0 L 125,0 125,200 0,200z" />
</vector>
```
as a vector drawable when called in
```kotlin
painterResource(id = R.drawable.placeholder)
```
for an Image composable. Furthermore, this is happening on my emulator that has API 30 (Android R) so this issue might not be limited to APIs below or equal to 21.
[Deleted User] <[Deleted User]> #5
ar...@dicoding.com <ar...@dicoding.com> #6
wa...@gmail.com <wa...@gmail.com> #7
al...@gmail.com <al...@gmail.com> #8
Some notes about the attachments:
- ic_pin.xml: I have the issue with this drawable
- ic_pin_full.xml: no issue with this
Thanks
ak...@gmail.com <ak...@gmail.com> #9
Same issue. It gives me the below stack trace for the following image. The issue has come up so far only on Nexus 5.
java.lang.IllegalArgumentException: Only VectorDrawables and rasterized asset types are supported ex. PNG, JPG
at androidx.compose.ui.res.PainterResources_androidKt.loadImageBitmapResource(PainterResources.android.kt:111)
at androidx.compose.ui.res.PainterResources_androidKt.painterResource(PainterResources.android.kt:70)
at app.storelab.storelabmarketplace.presentation.welcome.WelcomeScreenKt.WelcomeScreen(WelcomeScreen.kt:127)
at app.storelab.storelabmarketplace.presentation.navigation.OnBoardingNavigationKt$OnBoardingNavGraph$1$1.invoke(OnBoardingNavigation.kt:30)
at app.storelab.storelabmarketplace.presentation.navigation.OnBoardingNavigationKt$OnBoardingNavGraph$1$1.invoke(OnBoardingNavigation.kt:29)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:116)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
at androidx.navigation.compose.NavHostKt$NavHost$4$2.invoke(NavHost.kt:163)
at androidx.navigation.compose.NavHostKt$NavHost$4$2.invoke(NavHost.kt:162)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228)
at androidx.compose.runtime.saveable.SaveableStateHolderImpl.SaveableStateProvider(SaveableStateHolder.kt:84)
at androidx.navigation.compose.NavBackStackEntryProviderKt.SaveableStateProvider(NavBackStackEntryProvider.kt:60)
at androidx.navigation.compose.NavBackStackEntryProviderKt.access$SaveableStateProvider(NavBackStackEntryProvider.kt:1)
at androidx.navigation.compose.NavBackStackEntryProviderKt$LocalOwnersProvider$1.invoke(NavBackStackEntryProvider.kt:52)
at androidx.navigation.compose.NavBackStackEntryProviderKt$LocalOwnersProvider$1.invoke(NavBackStackEntryProvider.kt:51)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228)
at androidx.navigation.compose.NavBackStackEntryProviderKt.LocalOwnersProvider(NavBackStackEntryProvider.kt:47)
at androidx.navigation.compose.NavHostKt$NavHost$4.invoke(NavHost.kt:162)
at androidx.navigation.compose.NavHostKt$NavHost$4.invoke(NavHost.kt:141)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:116)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
at androidx.compose.animation.CrossfadeKt$Crossfade$4$1.invoke(Crossfade.kt:115)
at androidx.compose.animation.CrossfadeKt$Crossfade$4$1.invoke(Crossfade.kt:110)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
at androidx.compose.animation.CrossfadeKt.Crossfade(Crossfade.kt:124)
at androidx.compose.animation.CrossfadeKt.Crossfade(Crossfade.kt:55)
at androidx.navigation.compose.NavHostKt.NavHost(NavHost.kt:141)
at androidx.navigation.compose.NavHostKt$NavHost$5.invoke(NavHost.kt)
at androidx.navigation.compose.NavHostKt$NavHost$5.invoke(NavHost.kt)
at androidx.compose.runtime.RecomposeScopeImpl.compose(RecomposeScopeImpl.kt:145)
at androidx.compose.runtime.ComposerImpl.recomposeToGroupEnd(Composer.kt:2367)
at androidx.compose.runtime.ComposerImpl.skipToGroupEnd(Composer.kt:2657)
at androidx.compose.ui.platform.AbstractComposeView$ensureCompositionCreated$1.invoke(ComposeView.android.kt:250)
at androidx.compose.ui.platform.AbstractComposeView$ensureCompositionCreated$1.invoke(ComposeView.android.kt:249)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228)
at androidx.compose.ui.platform.CompositionLocalsKt.ProvideCommonCompositionLocals(CompositionLocals.kt:177)
at androidx.compose.ui.platform.AndroidCompositionLocals_androidKt$ProvideAndroidCompositionLocals$3.invoke(AndroidCompositionLocals.android.kt:123)
at androidx.compose.ui.platform.AndroidCompositionLocals_androidKt$ProvideAndroidCompositionLocals$3.invoke(AndroidCompositionLocals.android.kt:122)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228)
at androidx.compose.ui.platform.AndroidCompositionLocals_androidKt.ProvideAndroidCompositionLocals(AndroidCompositionLocals.android.kt:114)
at androidx.compose.ui.platform.AndroidCompositionLocals_androidKt$ProvideAndroidCompositionLocals$4.invoke(AndroidCompositionLocals.android.kt)
at androidx.compose.ui.platform.AndroidCompositionLocals_androidKt$ProvideAndroidCompositionLocals$4.invoke(AndroidCompositionLocals.android.kt)
at androidx.compose.runtime.RecomposeScopeImpl.compose(RecomposeScopeImpl.kt:145)
at androidx.compose.runtime.ComposerImpl.recomposeToGroupEnd(Composer.kt:2367)
at androidx.compose.runtime.ComposerImpl.skipCurrentGroup(Composer.kt:2634)
at androidx.compose.runtime.ComposerImpl$doCompose$2$5.invoke(Composer.kt:3250)
at androidx.compose.runtime.ComposerImpl$doCompose$2$5.invoke(Composer.kt:3228)
at androidx.compose.runtime.SnapshotStateKt__DerivedStateKt.observeDerivedStateRecalculations(DerivedState.kt:336)
at androidx.compose.runtime.SnapshotStateKt.observeDerivedStateRecalculations
at androidx.compose.runtime.ComposerImpl.doCompose(Composer.kt:3228)
at androidx.compose.runtime.ComposerImpl.recompose$runtime_release(Composer.kt:3193)
at androidx.compose.runtime.CompositionImpl.recompose(Composition.kt:753)
at androidx.compose.runtime.Recomposer.performRecompose(Recomposer.kt:1031)
at androidx.compose.runtime.Recomposer.access$performRecompose(Recomposer.kt:125)
at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$2.invoke(Recomposer.kt:534)
at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$2.invoke(Recomposer.kt:503)
at androidx.compose.ui.platform.AndroidUiFrameClock$withFrameNanos$2$callback$1.doFrame(AndroidUiFrameClock.android.kt:34)
at androidx.compose.ui.platform.AndroidUiDispatcher.performFrameDispatch(AndroidUiDispatcher.android.kt:109)
at androidx.compose.ui.platform.AndroidUiDispatcher.access$performFrameDispatch(AndroidUiDispatcher.android.kt:41)
at androidx.compose.ui.platform.AndroidUiDispatcher$dispatchCallback$1.doFrame(AndroidUiDispatcher.android.kt:69)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:856)
at android.view.Choreographer.doCallbacks(Choreographer.java:670)
at android.view.Choreographer.doFrame(Choreographer.java:603)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:844)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5421)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
ya...@gmail.com <ya...@gmail.com> #10
Same problem on API 22 emulator when I load the image placeholder for Coil in the lazy grid, it throws OutOfMemoryError
in some point:
I/art ( 2571): Clamp target GC heap from 387MB to 384MB
I/art ( 2571): Alloc concurrent mark sweep GC freed 4848(222KB) AllocSpace objects, 0(0B) LOS objects, 0% free, 383MB/384MB, paused 270us total 21.225ms
E/art ( 2571): Throwing OutOfMemoryError "Failed to allocate a 6350412 byte allocation with 227524 free bytes and 222KB until OOM"
I/art ( 2571): WaitForGcToComplete blocked for 28.530ms for cause Alloc
D/skia ( 2571): --- allocation failed for scaled bitmap
D/AndroidRuntime( 2571): Shutting down VM
--------- beginning of crash
E/AndroidRuntime( 2571): FATAL EXCEPTION: main
E/AndroidRuntime( 2571): Process: org.proninyaroslav.opencomicvine, PID: 2571
E/AndroidRuntime( 2571): java.lang.IllegalArgumentException: Only VectorDrawables and rasterized asset types are supported ex. PNG, JPG
E/AndroidRuntime( 2571): at androidx.compose.ui.res.PainterResources_androidKt.loadImageBitmapResource(PainterResources.android.kt:111)
E/AndroidRuntime( 2571): at androidx.compose.ui.res.PainterResources_androidKt.access$loadImageBitmapResource(PainterResources.android.kt:1)
E/AndroidRuntime( 2571): at androidx.compose.ui.res.PainterResources_androidKt.painterResource(PainterResources.android.kt:70)
E/AndroidRuntime( 2571): at org.proninyaroslav.opencomicvine.ui.components.CharacterCardKt.InnerCharacterCard(CharacterCard.kt:49)
E/AndroidRuntime( 2571): at org.proninyaroslav.opencomicvine.ui.components.CharacterCardKt.CharacterCard(CharacterCard.kt:26)
E/AndroidRuntime( 2571): at org.proninyaroslav.opencomicvine.ui.wiki.characters.CharactersPageKt$CharactersPage$8$2$3$2.invoke(CharactersPage.kt:205)
E/AndroidRuntime( 2571): at org.proninyaroslav.opencomicvine.ui.wiki.characters.CharactersPageKt$CharactersPage$8$2$3$2.invoke(CharactersPage.kt:203)
E/AndroidRuntime( 2571): at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:135)
E/AndroidRuntime( 2571): at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
E/AndroidRuntime( 2571): at androidx.compose.foundation.lazy.grid.ComposableSingletons$LazyGridItemProviderKt$lambda-1$1.invoke(LazyGridItemProvider.kt:88)
E/AndroidRuntime( 2571): at androidx.compose.foundation.lazy.grid.ComposableSingletons$LazyGridItemProviderKt$lambda-1$1.invoke(LazyGridItemProvider.kt:87)
E/AndroidRuntime( 2571): at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:135)
E/AndroidRuntime( 2571): at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
E/AndroidRuntime( 2571): at androidx.compose.foundation.lazy.layout.DefaultLazyLayoutItemsProvider.Item(LazyLayoutItemProvider.kt:118)
E/AndroidRuntime( 2571): at androidx.compose.foundation.lazy.grid.LazyGridItemProviderImpl.Item(LazyGridItemProvider.kt)
E/AndroidRuntime( 2571): at androidx.compose.foundation.lazy.layout.DefaultDelegatingLazyLayoutItemProvider.Item(LazyLayoutItemProvider.kt:197)
E/AndroidRuntime( 2571): at androidx.compose.foundation.lazy.grid.LazyGridItemProviderKt$rememberLazyGridItemProvider$1$1.Item(LazyGridItemProvider.kt)
E/AndroidRuntime( 2571): at androidx.compose.foundation.lazy.layout.LazyLayoutItemContentFactory$CachedItemContent$createContentLambda$1$1.invoke(LazyLayoutItemContentFactory.kt:99)
E/AndroidRuntime( 2571): at androidx.compose.foundation.lazy.layout.LazyLayoutItemContentFactory$CachedItemContent$createContentLambda$1$1.invoke(LazyLayoutItemContentFactory.kt:98)
E/AndroidRuntime( 2571): at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
E/AndroidRuntime( 2571): at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
E/AndroidRuntime( 2571): at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228)
E/AndroidRuntime( 2571): at androidx.compose.runtime.saveable.SaveableStateHolderImpl.SaveableStateProvider(SaveableStateHolder.kt:84)
E/AndroidRuntime( 2571): at androidx.compose.foundation.lazy.layout.LazySaveableStateHolder.SaveableStateProvider(LazySaveableStateHolder.kt:84)
E/AndroidRuntime( 2571): at androidx.compose.foundation.lazy.layout.LazyLayoutItemContentFactory$CachedItemContent$createContentLambda$1.invoke(LazyLayoutItemContentFactory.kt:98)
E/AndroidRuntime( 2571): at androidx.compose.foundation.lazy.layout.LazyLayoutItemContentFactory$CachedItemContent$createContentLambda$1.invoke(LazyLayoutItemContentFactory.kt:90)
E/AndroidRuntime( 2571): at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
E/AndroidRuntime( 2571): at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
E/AndroidRuntime( 2571): at androidx.compose.ui.layout.LayoutNodeSubcompositionsState$subcompose$2$1$1.invoke(SubcomposeLayout.kt:771)
E/AndroidRuntime( 2571): at androidx.compose.ui.layout.LayoutNodeSubcompositionsState$subcompose$2$1$1.invoke(SubcomposeLayout.kt:448)
E/AndroidRuntime( 2571): at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
E/AndroidRuntime( 2571): at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
E/AndroidRuntime( 2571): at androidx.compose.runtime.ActualJvm_jvmKt.invokeComposable(ActualJvm.jvm.kt:78)
E/AndroidRuntime( 2571): at androidx.compose.runtime.ComposerImpl$doCompose$2$5.invoke(Composer.kt:3248)
E/AndroidRuntime( 2571): at androidx.compose.runtime.ComposerImpl$doCompose$2$5.invoke(Composer
ed...@gmail.com <ed...@gmail.com> #11
al...@gmail.com <al...@gmail.com> #12
az...@gmail.com <az...@gmail.com> #13
ur...@gmail.com <ur...@gmail.com> #14
This happens for the preview
java.lang.IllegalArgumentException: Only VectorDrawables and rasterized asset types are supported ex. PNG, JPG
at androidx.compose.ui.res.PainterResources_androidKt.loadVectorResource(PainterResources.android.kt:94)
at androidx.compose.ui.res.PainterResources_androidKt.painterResource(PainterResources.android.kt:65)
at com.worldline.paynow.home.PayNowDrawerKt$NavItem$1.invoke(PayNowDrawer.kt:57)
at com.worldline.paynow.home.PayNowDrawerKt$NavItem$1.invoke(PayNowDrawer.kt:47)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:116)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
at androidx.compose.material3.CardKt$Card$1.invoke(Card.kt:806)
at androidx.compose.material3.CardKt$Card$1.invoke(Card.kt:92)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
at androidx.compose.material3.SurfaceKt$Surface$1.invoke(Surface.kt:129)
at androidx.compose.material3.SurfaceKt$Surface$1.invoke(Surface.kt:113)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228)
at androidx.compose.material3.SurfaceKt.Surface-T9BRK9s(Surface.kt:110)
at androidx.compose.material3.CardKt.Card(Card.kt:84)
at com.worldline.paynow.home.PayNowDrawerKt.NavItem(PayNowDrawer.kt:47)
at com.worldline.paynow.home.PayNowDrawerKt.PayNowDrawer(PayNowDrawer.kt:40)
at com.worldline.paynow.home.ComposableSingletons$MainActivityKt$lambda-7$1.invoke(MainActivity.kt:75)
at com.worldline.paynow.home.ComposableSingletons$MainActivityKt$lambda-7$1.invoke(MainActivity.kt:74)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228)
at androidx.compose.material3.TextKt.ProvideTextStyle(Text.kt:261)
at androidx.compose.material3.MaterialThemeKt$MaterialTheme$1.invoke(MaterialTheme.kt:81)
at androidx.compose.material3.MaterialThemeKt$MaterialTheme$1.invoke(MaterialTheme.kt:80)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228)
at androidx.compose.material3.MaterialThemeKt.MaterialTheme(MaterialTheme.kt:73)
at com.worldline.paynow.ui.theme.ThemeKt.ComposeTemplateTheme(Theme.kt:63)
at com.worldline.paynow.home.MainActivityKt.PayNowDrawerPreview(MainActivity.kt:74)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at androidx.compose.ui.tooling.ComposableInvoker.invokeComposableMethod(ComposableInvoker.kt:155)
at androidx.compose.ui.tooling.ComposableInvoker.invokeComposable(ComposableInvoker.kt:195)
at androidx.compose.ui.tooling.ComposeViewAdapter$init$3$1$composable$1.invoke(ComposeViewAdapter.kt:711)
at androidx.compose.ui.tooling.ComposeViewAdapter$init$3$1$composable$1.invoke(ComposeViewAdapter.kt:709)
at androidx.compose.ui.tooling.ComposeViewAdapter$init$3$1.invoke(ComposeViewAdapter.kt:746)
at androidx.compose.ui.tooling.ComposeViewAdapter$init$3$1.invoke(ComposeViewAdapter.kt:704)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228)
at androidx.compose.ui.tooling.InspectableKt.Inspectable(Inspectable.kt:61)
at androidx.compose.ui.tooling.ComposeViewAdapter$WrapPreview$1.invoke(ComposeViewAdapter.kt:651)
at androidx.compose.ui.tooling.ComposeViewAdapter$WrapPreview$1.invoke(ComposeViewAdapter.kt:650)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228)
at androidx.compose.ui.tooling.ComposeViewAdapter.WrapPreview(ComposeViewAdapter.kt:645)
at androidx.compose.ui.tooling.ComposeViewAdapter.access$WrapPreview(ComposeViewAdapter.kt:135)
at androidx.compose.ui.tooling.ComposeViewAdapter$init$3.invoke(ComposeViewAdapter.kt:704)
at androidx.compose.ui.tooling.ComposeViewAdapter$init$3.invoke(ComposeViewAdapter.kt:701)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
at androidx.compose.ui.platform.ComposeView.Content(ComposeView.android.kt:404)
at androidx.compose.ui.platform.AbstractComposeView$ensureCompositionCreated$1.invoke(ComposeView.android.kt:250)
at androidx.compose.ui.platform.AbstractComposeView$ensureCompositionCreated$1.invoke(ComposeView.android.kt:249)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228)
at androidx.compose.ui.platform.CompositionLocalsKt.ProvideCommonCompositionLocals(CompositionLocals.kt:177)
at androidx.compose.ui.platform.AndroidCompositionLocals_androidKt$ProvideAndroidCompositionLocals$3.invoke(AndroidCompositionLocals.android.kt:123)
at androidx.compose.ui.platform.AndroidCompositionLocals_androidKt$ProvideAndroidCompositionLocals$3.invoke(AndroidCompositionLocals.android.kt:122)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228)
at androidx.compose.ui.platform.AndroidCompositionLocals_androidKt.ProvideAndroidCompositionLocals(AndroidCompositionLocals.android.kt:114)
at androidx.compose.ui.platform.WrappedComposition$setContent$1$1$3.invoke(Wrapper.android.kt:157)
at androidx.compose.ui.platform.WrappedComposition$setContent$1$1$3.invoke(Wrapper.android.kt:156)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228)
at androidx.compose.ui.platform.WrappedComposition$setContent$1$1.invoke(Wrapper.android.kt:156)
at androidx.compose.ui.platform.WrappedComposition$setContent$1$1.invoke(Wrapper.android.kt:140)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
at androidx.compose.runtime.ActualJvm_jvmKt.invokeComposable(ActualJvm.jvm.kt:78)
at androidx.compose.runtime.ComposerImpl$doCompose$2$5.invoke(Composer.kt:3248)
at androidx.compose.runtime.ComposerImpl$doCompose$2$5.invoke(Composer.kt:3238)
at androidx.compose.runtime.SnapshotStateKt__DerivedStateKt.observeDerivedStateRecalculations(DerivedState.kt:341)
at androidx.compose.runtime.SnapshotStateKt.observeDerivedStateRecalculations(Unknown Source)
at androidx.compose.runtime.ComposerImpl.doCompose(Composer.kt:3238)
at androidx.compose.runtime.ComposerImpl.composeContent$runtime_release(Composer.kt:3173)
at androidx.compose.runtime.CompositionImpl.composeContent(Composition.kt:587)
at androidx.compose.runtime.Recomposer.composeInitial$runtime_release(Recomposer.kt:950)
at androidx.compose.runtime.CompositionImpl.setContent(Composition.kt:519)
at androidx.compose.ui.platform.WrappedComposition$setContent$1.invoke(Wrapper.android.kt:140)
at androidx.compose.ui.platform.WrappedComposition$setContent$1.invoke(Wrapper.android.kt:131)
at androidx.compose.ui.platform.AndroidComposeView.setOnViewTreeOwnersAvailable(AndroidComposeView.android.kt:1060)
at androidx.compose.ui.platform.WrappedComposition.setContent(Wrapper.android.kt:131)
at androidx.compose.ui.platform.WrappedComposition.onStateChanged(Wrapper.android.kt:182)
at androidx.lifecycle.LifecycleRegistry$ObserverWithState.dispatchEvent(LifecycleRegistry.java:360)
at androidx.lifecycle.LifecycleRegistry.addObserver(LifecycleRegistry.java:202)
at androidx.compose.ui.platform.WrappedComposition$setContent$1.invoke(Wrapper.android.kt:138)
at androidx.compose.ui.platform.WrappedComposition$setContent$1.invoke(Wrapper.android.kt:131)
at androidx.compose.ui.platform.AndroidComposeView.onAttachedToWindow(AndroidComposeView.android.kt:1147)
at android.view.View.dispatchAttachedToWindow(View.java:20753)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3490)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3497)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3497)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3497)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3497)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3497)
at android.view.AttachInfo_Accessor.setAttachInfo(AttachInfo_Accessor.java:58)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:366)
at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:436)
at com.android.tools.idea.layoutlib.LayoutLibrary.createSession(LayoutLibrary.java:121)
at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:717)
at com.android.tools.idea.rendering.RenderTask.lambda$inflate$9(RenderTask.java:873)
at com.android.tools.idea.rendering.RenderExecutor$runAsyncActionWithTimeout$3.run(RenderExecutor.kt:192)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)
na...@gmail.com <na...@gmail.com> #15
The issue seems not like a issue for tiramisu.
as...@box.com <as...@box.com> #16
br...@monzo.com <br...@monzo.com> #17
ja...@gmail.com <ja...@gmail.com> #18
@ #17 yes, I pointed that out in this report a year ago but unfortunately nothing has changed yet.
Instead, I've now copied the painterResource()
code and modified it so that instead of crashing, it logs an error to Crashlytics (through Timber) and shows a grey block as a fallback. I only recently wrote this so I didn't receive any error logs from devices in the field yet. Once I do, I'll finally know the real cause of this crash. In the meantime, at least devices affected by it won't crash anymore!
import android.content.res.Resources
import android.util.TypedValue
import androidx.annotation.DrawableRes
import androidx.compose.runtime.Composable
import androidx.compose.runtime.ReadOnlyComposable
import androidx.compose.runtime.remember
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.ImageBitmap
import androidx.compose.ui.graphics.painter.BitmapPainter
import androidx.compose.ui.graphics.painter.ColorPainter
import androidx.compose.ui.graphics.painter.Painter
import androidx.compose.ui.platform.LocalConfiguration
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.imageResource
import androidx.compose.ui.res.painterResource
import timber.log.Timber
/**
* Copied from `androidx.compose.ui.res.PainterResources.android.kt`.
*
* Only rasterized image handling is altered, VectorDrawable requests are
* passed through to the original Compose code. See comments inside for modifications.
*/
@Composable
fun fallbackPainterResource(@DrawableRes id: Int): Painter {
val context = LocalContext.current
val res = resources()
val value = remember { TypedValue() }
res.getValue(id, value, true)
val path = value.string
// Assume .xml suffix implies loading a VectorDrawable resource
return if (path?.endsWith(".xml") == true) {
/**
* ***** MODIFIED *****
* Original code:
* val imageVector = loadVectorResource(context.theme, res, id, value.changingConfigurations)
* rememberVectorPainter(imageVector)
*
* Modified code: calls the original painterResource for handling VectorDrawables.
* ***** MODIFIED *****
*/
painterResource(id = id)
} else {
// Otherwise load the bitmap resource
/**
* ***** MODIFIED *****
* Original code: throws throwable.
* Modified code: falls back to showing a gray color when loading image fails.
* ***** MODIFIED *****
*/
val imageBitmap = remember(path, id, context.theme) {
loadImageBitmapResource(res, id)
}
if (imageBitmap != null) {
BitmapPainter(imageBitmap)
} else {
ColorPainter(Color.LightGray)
}
}
}
/**
* Copied from `androidx.compose.ui.res.PainterResources.android.kt`.
*
* ***** MODIFIED *****
* Original code: catches exception, but throws other instead, hiding original cause.
* Modified code: logs original throwable, and returns null.
* ***** MODIFIED *****
*/
private fun loadImageBitmapResource(res: Resources, id: Int): ImageBitmap? {
return try {
ImageBitmap.imageResource(res, id)
} catch (throwable: Throwable) {
Timber.e(throwable, "Failed to load resource $id")
return null
}
}
/**
* Copied from `androidx.compose.ui.res.Resources.android.kt`.
*/
@Composable
@ReadOnlyComposable
private fun resources(): Resources {
LocalConfiguration.current
return LocalContext.current.resources
}
al...@gmail.com <al...@gmail.com> #19
The issue was Out Of Memory and I fixed by replacing the pngs to the drawable-nodpi folder. For some reason the images were being stretched.
ap...@google.com <ap...@google.com> #20
Branch: androidx-main
commit 0232cb448f662706185dd836279f187aa49fb27f
Author: Nader Jawad <njawad@google.com>
Date: Mon May 22 23:12:14 2023
Improved error messaging of painterResource
Updated painterResource implementation to provide
more descriptive error messages and include the
name of the asset that is attempted to be loaded.
Added explicit messaging of webp support.
Relnote: "Add ResourceResolutionException type
to wrap throwables thrown when attempting to load
bitmap assets with a description of the asset path
that failed to load."
Fixes: 230166331
Fixes: 278424788
Test: Added test to verify webp image loading
Change-Id: I19f445605ae8b171532b73b7ae4697cec0453767
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/ImageTest.kt
A compose/foundation/foundation/src/androidAndroidTest/res/drawable-nodpi/webp_test.webp
M compose/ui/ui/api/current.txt
M compose/ui/ui/api/restricted_current.txt
M compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/res/PainterResources.android.kt
nj...@google.com <nj...@google.com>
pr...@google.com <pr...@google.com> #21
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.compose.foundation:foundation:1.6.0-alpha01
androidx.compose.foundation:foundation-android:1.6.0-alpha01
androidx.compose.ui:ui:1.6.0-alpha01
androidx.compose.ui:ui-android:1.6.0-alpha01
no...@gmail.com <no...@gmail.com> #22
Reproduced on Pixel 4 API 32 emulator. It my case it doesn't work with isShrinkResources = true
FATAL EXCEPTION: main
Process: app.dexvpn, PID: 18745
java.lang.IllegalArgumentException: Only VectorDrawables and rasterized asset types are supported ex. PNG, JPG
at app.dexvpn.vm2.j0(SourceFile:1134)
at app.dexvpn.bw2.f(SourceFile:164)
at app.dexvpn.vl0.q(SourceFile:380)
at app.dexvpn.vl0.p(SourceFile:217)
at app.dexvpn.bg5.k0(SourceFile:111)
at app.dexvpn.en0.b(SourceFile:51)
at app.dexvpn.en0.k0(Unknown Source:8)
at app.dexvpn.n33.k0(SourceFile:215)
at app.dexvpn.en0.b(SourceFile:51)
at app.dexvpn.en0.k0(Unknown Source:8)
at app.dexvpn.k23.a(SourceFile:266)
at app.dexvpn.k23.invoke(SourceFile:174)
at app.dexvpn.en0.invoke(SourceFile:59)
at app.dexvpn.bw2.h(SourceFile:182)
at app.dexvpn.xp5.c(SourceFile:185)
at app.dexvpn.q70.K(SourceFile:80)
at app.dexvpn.y33.e(SourceFile:88)
at app.dexvpn.ek2.a(SourceFile:270)
at app.dexvpn.ek2.invoke(SourceFile:258)
at app.dexvpn.en0.invoke(SourceFile:59)
at app.dexvpn.bw2.h(SourceFile:182)
at app.dexvpn.v75.f(SourceFile:115)
at app.dexvpn.r43.f(SourceFile:33)
at app.dexvpn.dp2.i(SourceFile:83)
at app.dexvpn.jf1.b(SourceFile:753)
at app.dexvpn.jf1.invoke(SourceFile:194)
at app.dexvpn.en0.invoke(SourceFile:59)
at app.dexvpn.jf1.b(SourceFile:427)
at app.dexvpn.jf1.invoke(SourceFile:82)
at app.dexvpn.en0.invoke(SourceFile:59)
at app.dexvpn.p31.y(Unknown Source:19)
at app.dexvpn.ip0.p(SourceFile:131)
at app.dexvpn.ip0.i(Unknown Source:13)
at app.dexvpn.xp0.p(SourceFile:18)
at app.dexvpn.ow4.a(SourceFile:31)
at app.dexvpn.wo0.a(SourceFile:10)
at app.dexvpn.wo0.a(SourceFile:10)
at app.dexvpn.wo0.a(SourceFile:10)
at app.dexvpn.wo0.a(SourceFile:10)
at app.dexvpn.wo0.a(SourceFile:10)
at app.dexvpn.xp0.g(Unknown Source:10)
at app.dexvpn.r13.c(SourceFile:102)
at app.dexvpn.m13.v(SourceFile:146)
at app.dexvpn.u23.a(SourceFile:36)
at app.dexvpn.g43.a(SourceFile:17)
at app.dexvpn.c43.invoke(SourceFile:673)
at app.dexvpn.jf1.invoke(SourceFile:179)
at app.dexvpn.o13.f(SourceFile:101)
at app.dexvpn.pl2.c(SourceFile:47)
at app.dexvpn.vb.f(SourceFile:59)
at app.dexvpn.vb.D(SourceFile:632)
at app.dexvpn.p03.g(SourceFile:13)
at app.dexvpn.r03.c(SourceFile:11)
at app.dexvpn.vb.f(SourceFile:20)
at app.dexvpn.vb.D(SourceFile:649)
at app.dexvpn.p03.g(SourceFile:13)
at app.dexvpn.r03.c(SourceFile:11)
at app.dexvpn.tp5.g(SourceFile:6)
at app.dexvpn.r03.c(SourceFile:11)
at app.dexvpn.as1.g(SourceFile:104)
at app.dexvpn.r03.c(SourceFile:11)
at app.dexvpn.e13.a(SourceFile:50)
at app.dexvpn.e13.m(SourceFile:17)
at app.dexvpn.ej1.f(SourceFile:64)
at app.dexvpn.ku5.a(SourceFile:60)
at app.dexvpn.lu5.c(SourceFile:71)
at app.dexvpn.wa4.a(Unknown Source:12)
at app.dexvpn.i13.z0(SourceFile:113)
at app.dexvpn.xi3.c(SourceFile:58)
at app.dexvpn.xi3.j(SourceFile:133)
at app.dexvpn.xi3.d(SourceFile:86)
at app.dexvpn.xi3.d(SourceFile:101)
at app.dexvpn.xi3.d(SourceFile:101)
at app.dexvpn.xi3.d(SourceFile:101)
at androidx.compose.ui.platform.AndroidComposeView.i(Unknown Source:7)
at app.dexvpn.i13.z0(SourceFile:50)
at app.dexvpn.i13.c(SourceFile:124)
at app.dexvpn.mf.f(SourceFile:59)
at app.dexvpn.pl2.c(SourceFile:47)
at app.dexvpn.te.c(SourceFile:27)
at app.dexvpn.te.D(SourceFile:103)
at app.dexvpn.p03.g(SourceFile:13)
at app.dexvpn.r03.c(SourceFile:11)
at app.dexvpn.e13.a(SourceFile:50)
at app.dexvpn.e13.m(SourceFile:17)
at app.dexvpn.ej1.f(SourceFile:64)
at app.dexvpn.ku5.a(SourceFile:60)
at app.dexvpn.lu5.c(SourceFile:71)
at app.dexvpn.wa4.a(Unknown Source:12)
at app.dexvpn.i13.z0(SourceFile:113)
at app.dexvpn.xi3.c(SourceFile:58)
at app.dexvpn.xi3.j(SourceFile:133)
at app.dexvpn.xi3.f(SourceFile:73)
at androidx.compose.ui.platform.AndroidComposeView.q(SourceFile:14)
at app.dexvpn.ua4.a(Unknown Source:3)
at androidx.compose.ui.platform.AndroidComposeView.dispatchDraw(SourceFile:19)
at android.view.View.draw(View.java:22707)
at android.view.View.updateDisplayListIfDirty(View.java:21579)
2023-09-13 18:52:31.152 18745-18745 AndroidRuntime app.dexvpn E at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4512)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4485)
at android.view.View.updateDisplayListIfDirty(View.java:21535)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4512)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4485)
at android.view.View.updateDisplayListIfDirty(View.java:21535)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4512)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4485)
at android.view.View.updateDisplayListIfDirty(View.java:21535)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4512)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4485)
at android.view.View.updateDisplayListIfDirty(View.java:21535)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4512)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4485)
at android.view.View.updateDisplayListIfDirty(View.java:21535)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4512)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4485)
at android.view.View.updateDisplayListIfDirty(View.java:21535)
at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:534)
at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:540)
at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:616)
at android.view.ViewRootImpl.draw(ViewRootImpl.java:4488)
at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:4208)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:3368)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2173)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:8750)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1037)
at android.view.Choreographer.doCallbacks(Choreographer.java:845)
at android.view.Choreographer.doFrame(Choreographer.java:780)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1022)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7798)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
as...@gmail.com <as...@gmail.com> #23
Any possible workaround? 1.6.0 is not stable yet
Description
Issue
Loading the PNG image attached to this post ("missing_picture.png") like this:
... triggers this exception in production on Android 5, 6 and 7 (my minSdk is 21):
The image is actually a PNG, so the error is incorrect. I ran a tool called
pngcheck
on both the source image and the image as it ends up in the APK, but it tells me everything is OK. Also, this PNG works fine on Android 8+.Investigation
Unfortunately, I cannot reproduce it in an emulator. In
PainterResources.android.kt
I see this code:To me, it seems this incorrectly swallows the real exception.