end cannot negative. [end: -1] at androidx.compose.ui.text.TextRangeKt.packWithCheck(TextRangeKt.jav

项目场景:

Compose写的app


问题描述

上架谷歌平台遇到的这个报错

end cannot negative. [end: -1] at androidx.compose.ui.text.TextRangeKt.packWithCheck(TextRangeKt.jav_第1张图片


原因分析:

看了报错和定位到的源码
end cannot negative. [end: -1] at androidx.compose.ui.text.TextRangeKt.packWithCheck(TextRangeKt.jav_第2张图片
大概意思就是我使用TextField,然后里面的基础组件CoreTextField中,有对这个方法的调用,它会监听输入字符串的开始结束字符串,这里的意思就是end为负数然后抛出了异常,但是我点开我的app输入输出,根本不会崩溃,看来是特殊机型的问题,所以我很难受,最后通过查看github上的issue,发现有人跟我遇到相同的问题
https://github.com/JetBrains/compose-multiplatform/issues/2023


解决方案:

最后我升级了我的compose版本到1.3.0,解决了这个问题
end cannot negative. [end: -1] at androidx.compose.ui.text.TextRangeKt.packWithCheck(TextRangeKt.jav_第3张图片

你可能感兴趣的:(Android日常,android,kotlin,ui,开发语言,android,studio)