element-hq / element-x-android

Android Matrix messenger application using the Matrix Rust Sdk and Jetpack Compose
Apache License 2.0
951 stars 129 forks source link

App crashes on emulator with API level 23 #2124

Closed surakin closed 8 months ago

surakin commented 8 months ago

Steps to reproduce

I was trying to test PR #2122 on API level 23 but I crash every time I open any room

File res/drawable-xxhdpi-v4/ic_plus.png seems to be missing :thinking:

This did not happen with API level 25. (Or 30 like I was using originally)

2023-12-28 20:34:29.028  4397-4397  AndroidRuntime          io.element.android.x.debug           E  FATAL EXCEPTION: main
                                                                                                    Process: io.element.android.x.debug, PID: 4397
                                                                                                    android.content.res.Resources$NotFoundException: File res/drawable-xxhdpi-v4/ic_plus.png from xml type xml resource ID #0x7f08016a
                                                                                                        at android.content.res.Resources.loadXmlResourceParser(Resources.java:2821)
                                                                                                        at android.content.res.Resources.loadXmlResourceParser(Resources.java:2776)
                                                                                                        at android.content.res.Resources.getXml(Resources.java:1214)
                                                                                                        at androidx.compose.ui.res.VectorResources_androidKt.vectorResource(VectorResources.android.kt:70)
                                                                                                        at androidx.compose.ui.res.VectorResources_androidKt.vectorResource(VectorResources.android.kt:54)
                                                                                                        at io.element.android.libraries.designsystem.theme.components.IconKt.Icon-ww6aTOc(Icon.kt:119)
                                                                                                        at io.element.android.libraries.textcomposer.components.ComposableSingletons$ComposerOptionsButtonKt$lambda-1$1.invoke(ComposerOptionsButton.kt:42)
                                                                                                        at io.element.android.libraries.textcomposer.components.ComposableSingletons$ComposerOptionsButtonKt$lambda-1$1.invoke(ComposerOptionsButton.kt:41)
                                                                                                        at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:109)
                                                                                                        at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
                                                                                                        at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:248)
                                                                                                        at androidx.compose.material3.IconButtonKt.IconButton(IconButton.kt:102)
                                                                                                        at io.element.android.libraries.designsystem.theme.components.IconButtonKt.IconButton(IconButton.kt:49)
                                                                                                        at io.element.android.libraries.textcomposer.components.ComposerOptionsButtonKt.ComposerOptionsButton(ComposerOptionsButton.kt:37)
                                                                                                        at io.element.android.libraries.textcomposer.TextComposerKt$TextComposer$composerOptionsButton$1$1.invoke(TextComposer.kt:141)
                                                                                                        at io.element.android.libraries.textcomposer.TextComposerKt$TextComposer$composerOptionsButton$1$1.invoke(TextComposer.kt:140)
                                                                                                        at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:109)
                                                                                                        at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
                                                                                                        at io.element.android.libraries.textcomposer.TextComposerKt.StandardLayout(TextComposer.kt:324)
                                                                                                        at io.element.android.libraries.textcomposer.TextComposerKt.TextComposer-zg6CI5Q(TextComposer.kt:253)
                                                                                                        at io.element.android.features.messages.impl.messagecomposer.MessageComposerViewKt.MessageComposerView(MessageComposerView.kt:99)
                                                                                                        at io.element.android.features.messages.impl.MessagesViewKt.MessagesViewComposerBottomSheetContents(MessagesView.kt:432)
                                                                                                        at io.element.android.features.messages.impl.MessagesViewKt.access$MessagesViewComposerBottomSheetContents(MessagesView.kt:1)
                                                                                                        at io.element.android.features.messages.impl.MessagesViewKt$MessagesViewContent$1$6.invoke(MessagesView.kt:395)
                                                                                                        at io.element.android.features.messages.impl.MessagesViewKt$MessagesViewContent$1$6.invoke(MessagesView.kt:394)
                                                                                                        at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:118)
                                                                                                        at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
                                                                                                        at io.element.android.features.messages.impl.ExpandableBottomSheetScaffoldKt$ExpandableBottomSheetScaffold$2$1$sheetContentSub$1.invoke(ExpandableBottomSheetScaffold.kt:119)
                                                                                                        at io.element.android.features.messages.impl.ExpandableBottomSheetScaffoldKt$ExpandableBottomSheetScaffold$2$1$sheetContentSub$1.invoke(ExpandableBottomSheetScaffold.kt:119)
                                                                                                        at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:109)
                                                                                                        at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
                                                                                                        at androidx.compose.ui.layout.LayoutNodeSubcompositionsState$subcompose$3$1$1.invoke(SubcomposeLayout.kt:984)
                                                                                                        at androidx.compose.ui.layout.LayoutNodeSubcompositionsState$subcompose$3$1$1.invoke(SubcomposeLayout.kt:476)
                                                                                                        at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:109)
                                                                                                        at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
                                                                                                        at androidx.compose.runtime.ActualJvm_jvmKt.invokeComposable

Outcome

What did you expect?

Room should open normally

What happened instead?

App crashes every time

Your phone model

Emulator

Operating system version

Android 6.0 Marshmallow

Application version and app store

Element X version 0.4.2 (develop branch)

Homeserver

matrix.org

Will you send logs?

No

Are you willing to provide a PR?

No

jmartinesp commented 8 months ago

Thanks for the report! It seems like we're using ImageVector.vectorResource(id) and on API 23 Android is trying to fetch a rasterised png image instead, and crashing. This is super weird, because as far as I know, these rasterised pngs should only be used in APIs <21.