https://kotlinlang.org logo
#android
Title
# android
n

Nat Strangerweather

08/06/2022, 9:39 AM
I have a Kotlin/Compose app which runs well in Android 30 and 31 but crashes with an indexOutOfBoundsException on first install in Android 32 and 33 (on emulators). We've established in the #compose channel that the code is fine (thanks Lukasz). Is this something I should report in the bug tracker? Or is there a known reason why this might be happening?
s

Suraj Sahani

08/06/2022, 9:40 AM
Hey Nat, Please share logcat. It help to understand bug more
n

Nat Strangerweather

08/06/2022, 9:46 AM
Hi Martial, here it is. This is Api 32:
Copy code
2022-08-06 10:45:40.813 4278-4278/? E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.strangerweather.words, PID: 4278
    java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
        at java.util.ArrayList.get(ArrayList.java:437)
        at com.strangerweather.words.components.boards.DrawBoardKt$DrawBoard$1$1.invoke(DrawBoard.kt:98)
        at com.strangerweather.words.components.boards.DrawBoardKt$DrawBoard$1$1.invoke(DrawBoard.kt:79)
        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.RecomposeScopeImpl.compose(RecomposeScopeImpl.kt:145)
        at androidx.compose.runtime.ComposerImpl.recomposeToGroupEnd(Composer.kt:2363)
        at androidx.compose.runtime.ComposerImpl.skipCurrentGroup(Composer.kt:2630)
        at androidx.compose.runtime.ComposerImpl$doCompose$2$5.invoke(Composer.kt:3217)
        at androidx.compose.runtime.ComposerImpl$doCompose$2$5.invoke(Composer.kt:3195)
        at androidx.compose.runtime.SnapshotStateKt__DerivedStateKt.observeDerivedStateRecalculations(DerivedState.kt:336)
        at androidx.compose.runtime.SnapshotStateKt.observeDerivedStateRecalculations(Unknown Source:1)
        at androidx.compose.runtime.ComposerImpl.doCompose(Composer.kt:3195)
        at androidx.compose.runtime.ComposerImpl.recompose$runtime_release(Composer.kt:3160)
        at androidx.compose.runtime.CompositionImpl.recompose(Composition.kt:748)
        at androidx.compose.runtime.Recomposer.performRecompose(Recomposer.kt:876)
        at androidx.compose.runtime.Recomposer.access$performRecompose(Recomposer.kt:107)
        at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$2.invoke(Recomposer.kt:485)
        at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$2.invoke(Recomposer.kt:454)
        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:1035)
        at android.view.Choreographer.doCallbacks(Choreographer.java:845)
        at android.view.Choreographer.doFrame(Choreographer.java:775)
        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:7842)
        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)
    	Suppressed: kotlinx.coroutines.DiagnosticCoroutineContextException: [androidx.compose.runtime.PausableMonotonicFrameClock@10fe566, androidx.compose.ui.platform.MotionDurationScaleImpl@e8df0a7, StandaloneCoroutine{Cancelling}@9ec8954, AndroidUiDispatcher@68640fd]
And this is Api 33:
Copy code
2022-08-05 22:02:53.971 3615-3615/? E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.strangerweather.words, PID: 3615
    java.lang.IndexOutOfBoundsException: Index: 25, Size: 25
        at java.util.ArrayList.get(ArrayList.java:437)
        at com.strangerweather.words.components.boards.GameBoardKt$GameBoard$2.invoke(GameBoard.kt:131)
        at com.strangerweather.words.components.boards.GameBoardKt$GameBoard$2.invoke(GameBoard.kt:114)
        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.RecomposeScopeImpl.compose(RecomposeScopeImpl.kt:145)
        at androidx.compose.runtime.ComposerImpl.recomposeToGroupEnd(Composer.kt:2363)
        at androidx.compose.runtime.ComposerImpl.skipToGroupEnd(Composer.kt:2653)
        at com.strangerweather.words.utils.GridKt.VerticalGrid(Grid.kt:70)
        at com.strangerweather.words.components.boards.GameBoardKt.GameBoard(GameBoard.kt:107)
        at com.strangerweather.words.components.boards.GameBoardKt$GameBoard$3.invoke(Unknown Source:4)
        at com.strangerweather.words.components.boards.GameBoardKt$GameBoard$3.invoke(Unknown Source:10)
        at androidx.compose.runtime.RecomposeScopeImpl.compose(RecomposeScopeImpl.kt:145)
        at androidx.compose.runtime.ComposerImpl.recomposeToGroupEnd(Composer.kt:2363)
        at androidx.compose.runtime.ComposerImpl.skipCurrentGroup(Composer.kt:2630)
        at androidx.compose.runtime.ComposerImpl$doCompose$2$5.invoke(Composer.kt:3217)
        at androidx.compose.runtime.ComposerImpl$doCompose$2$5.invoke(Composer.kt:3195)
        at androidx.compose.runtime.SnapshotStateKt__DerivedStateKt.observeDerivedStateRecalculations(DerivedState.kt:336)
        at androidx.compose.runtime.SnapshotStateKt.observeDerivedStateRecalculations(Unknown Source:1)
        at androidx.compose.runtime.ComposerImpl.doCompose(Composer.kt:3195)
        at androidx.compose.runtime.ComposerImpl.recompose$runtime_release(Composer.kt:3160)
        at androidx.compose.runtime.CompositionImpl.recompose(Composition.kt:748)
        at androidx.compose.runtime.Recomposer.performRecompose(Recomposer.kt:876)
        at androidx.compose.runtime.Recomposer.access$performRecompose(Recomposer.kt:107)
        at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$2.invoke(Recomposer.kt:485)
        at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$2.invoke(Recomposer.kt:454)
        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:1229)
        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1239)
        at android.view.Choreographer.doCallbacks(Choreographer.java:899)
        at android.view.Choreographer.doFrame(Choreographer.java:827)
        at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1214)
        at android.os.Handler.handleCallback(Handler.java:942)
        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:7898)
        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:936)
    	Suppressed: kotlinx.coroutines.DiagnosticCoroutineContextException: [androidx.compose.runtime.PausableMonotonicFrameClock@33df20a, androidx.compose.ui.platform.MotionDurationScaleImpl@edb4a7b, StandaloneCoroutine{Cancelling}@a326098, AndroidUiDispatcher@e71a0f1]
s

Suraj Sahani

08/06/2022, 9:54 AM
It this project related to 2D games?
n

Nat Strangerweather

08/06/2022, 9:55 AM
It is a type of Scrabble game...
s

Suraj Sahani

08/06/2022, 9:59 AM
Can you also share piece of code which is creating issue.
n

Nat Strangerweather

08/06/2022, 10:04 AM
Do you happen to be on the #compose channel as well? I can link you to the thread that has some code snippets.
s

Suraj Sahani

08/06/2022, 10:06 AM
Sure. Joined just now.
8 Views