https://kotlinlang.org logo
#compose
Title
# compose
z

Zoltan Demant

05/20/2022, 4:22 AM
Has anyone else started seeing more and more
Fatal Exception: java.lang.IllegalArgumentException: end cannot negative. [end: -1]
since one of the recent compose (alpha/beta) releases?
1
Ive reported it already; but given how frequently Im seeing it happen Im surprised that nobody is talking about it. Did I break something?
Copy code
Fatal Exception: java.lang.IllegalArgumentException: end cannot negative. [end: -1]
       at androidx.compose.ui.text.TextRangeKt.packWithCheck(TextRangeKt.java:124)
       at androidx.compose.ui.text.TextRangeKt.TextRange(TextRangeKt.java:37)
       at androidx.compose.ui.text.input.EditingBuffer.delete$ui_text_release(EditingBuffer.kt:205)
       at androidx.compose.ui.text.input.DeleteSurroundingTextCommand.applyTo(EditCommand.kt:271)
       at androidx.compose.ui.text.input.EditProcessor.apply(EditProcessor.java:110)
       at androidx.compose.foundation.text.TextFieldKeyInput.apply(TextFieldKeyInput.kt:62)
       at androidx.compose.foundation.text.TextFieldKeyInput.access$apply(TextFieldKeyInput.java:49)
       at androidx.compose.foundation.text.TextFieldKeyInput$process$2.invoke(TextFieldKeyInput.java:134)
       at androidx.compose.foundation.text.TextFieldKeyInput$process$2.invoke(TextFieldKeyInput.java:102)
       at androidx.activity.compose.BackHandlerKt$BackHandler$2.invoke$bridge(BackHandler.kt:986)
       at androidx.compose.foundation.text.TextFieldKeyInput.commandExecutionContext(TextFieldKeyInput.java:211)
       at androidx.compose.foundation.text.TextFieldKeyInput.process-ZmokQxo(TextFieldKeyInput.java:102)
       at androidx.compose.foundation.text.TextFieldKeyInputKt$textFieldKeyInput$2$1.invoke-ZmokQxo(TextFieldKeyInputKt.java:243)
       at androidx.compose.foundation.text.TextFieldKeyInputKt$textFieldKeyInput$2$1.invoke(TextFieldKeyInputKt.java:243)
       at androidx.compose.animation.core.InfiniteTransition$run$1$1.invoke$bridge(InfiniteTransition.kt:254)
       at androidx.compose.ui.input.key.KeyInputModifier.propagateKeyEvent-ZmokQxo(KeyInputModifier.kt:124)
       at androidx.compose.ui.input.key.KeyInputModifier.processKeyInput-ZmokQxo(KeyInputModifier.java:103)
       at androidx.compose.ui.platform.AndroidComposeView.sendKeyEvent-ZmokQxo(AndroidComposeView.android.kt:588)
       at androidx.compose.ui.platform.AndroidComposeView.dispatchKeyEvent(AndroidComposeView.android.kt:595)
       at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1949)
       at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1949)
       at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1949)
       at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1949)
       at com.android.internal.policy.DecorView.superDispatchKeyEvent(DecorView.java:722)
       at com.android.internal.policy.PhoneWindow.superDispatchKeyEvent(PhoneWindow.java:1942)
       at android.app.Dialog.dispatchKeyEvent(Dialog.java:972)
       at com.android.internal.policy.DecorView.dispatchKeyEvent(DecorView.java:588)
       at android.view.ViewRootImpl$ViewPostImeInputStage.processKeyEvent(ViewRootImpl.java:6436)
       at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:6300)
       at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5742)
       at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5795)
       at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5761)
       at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:5917)
       at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5769)
       at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:5974)
       at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5742)
       at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5795)
       at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5761)
       at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5769)
       at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5742)
       at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5795)
       at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5761)
       at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:5950)
       at android.view.ViewRootImpl$ImeInputStage.onFinishedInputEvent(ViewRootImpl.java:6119)
       at android.view.inputmethod.InputMethodManager$PendingEvent.run(InputMethodManager.java:3821)
       at android.view.inputmethod.InputMethodManager.invokeFinishedInputEventCallback(InputMethodManager.java:3303)
       at android.view.inputmethod.InputMethodManager.finishedInputEvent(InputMethodManager.java:3294)
       at android.view.inputmethod.InputMethodManager$ImeInputEventSender.onInputEventFinished(InputMethodManager.java:3798)
       at android.view.InputEventSender.dispatchInputEventFinished(InputEventSender.java:143)
       at android.os.MessageQueue.nativePollOnce(MessageQueue.java)
       at android.os.MessageQueue.next(MessageQueue.java:336)
       at android.os.Looper.loop(Looper.java:197)
       at android.app.ActivityThread.main(ActivityThread.java:8016)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1076)
s

Stylianos Gakis

05/20/2022, 6:48 AM
No it’s not only you, we started experiencing this exact same bug yesterday as well. Specifically we got 1 crash each on each Android versions 8-9-10 and 2 on Android 11, in various device models. Worst thing is, we’re not actually depending on 1.2.x for any compose dependency. But running
./gradlew -q :app:dependencies --configuration releaseRuntimeClasspath
shows me that we somehow are in fact pulling 1.2.x foundation (which I think is where the crash happens) deps as transitive dependencies. I literally have no idea how to fix this, and trying to rely strictly on foundation 1.1.1 might be a temp solution but I am both not sure if that would work or that this is a sustainable way to work with such problems.
z

Zoltan Demant

05/20/2022, 7:19 AM
Sorry to hear that youre also experiencing it @Stylianos Gakis; bugs like this have definitely been one of the big drawbacks with compose for me thus far. At the very least I find comfort in the fact that its not affecting a lot of users (probably below 1% for me) and that the compose team has been very responsive with similar bugs in the past. Im not 100% sure, but I think Ive seen this bug with earlier versions of compose too; definitely seeing more of it with 1.2.0-x though.
s

Stylianos Gakis

05/20/2022, 7:40 AM
Do you have numbers bigger than 1-2 users per Android OS version? I was just thinking I saw someone somewhere mention that they got the same crash but they believe it was the automatic testing that triggered it, so probably nothing to be worried about. At least not if the number of crashes doesn’t increase going forward
a

Albert Chang

05/20/2022, 7:55 AM
Commented with a repro.
😍 4
z

Zoltan Demant

05/20/2022, 8:04 AM
@Stylianos Gakis Usually 1-2 times per user. I received reports about it happening in the production channel 2 days ago, and theres no automatic testing done (latest release on there was 14+ days ago). I cant recall which compose version exactly Im using there, but it certainly isnt anything above 1.2.0-alpha07.
🙌 1
2 Views