gpt4 book ai didi

androidx.appcompat.widget.AppCompatTextView 与 API < 26 不兼容

转载 作者:行者123 更新时间:2023-12-03 21:02:27 36 4
gpt4 key购买 nike

将我们的项目迁移到 androidx 后,我遇到了一个奇怪的问题。我们使用从 androidx.appcompat.widget.AppCompatTextView 扩展而来的自定义 View 。但是,应用程序在 API < 26 的设备上崩溃,并带有以下堆栈跟踪(仅剪切到相关部分):

java.lang.NoClassDefFoundError: android.view.textclassifier.TextClassifier
at libcore.reflect.InternalNames.getClass(InternalNames.java:55)
at java.lang.Class.getDexCacheType(Class.java:2551)
at java.lang.reflect.AbstractMethod.getParameterTypes(AbstractMethod.java:169)
at java.lang.reflect.Method.getParameterTypes(Method.java:193)
at org.greenrobot.eventbus.SubscriberMethodFinder.findUsingReflectionInSingleClass(SubscriberMethodFinder.java:163)
at org.greenrobot.eventbus.SubscriberMethodFinder.findUsingInfo(SubscriberMethodFinder.java:88)
at org.greenrobot.eventbus.SubscriberMethodFinder.findSubscriberMethods(SubscriberMethodFinder.java:64)
at org.greenrobot.eventbus.EventBus.register(EventBus.java:140)
at com.chrono24.mobile.controls.LocalizedTextView.onAttachedToWindow(LocalizedTextView.kt:65)

现在,正如我所见,android.view.textclassifier.TextClassifier 添加了 API 26,这可以解释为什么缺少该类。如果我将 AppCompatTextView 更改为普通的旧 TextView,应用程序将再次启动而不会崩溃。知道为什么会发生这种情况以及如何解决吗?提前致谢。

最佳答案

你只需要确保你没有使用自定义字体或 .ttf 文件
如果您正在使用,则将您的 .ttf 文件转换为 .otf 它将适用于 android 10
这是 android 10 现在的一个已知问题。

关于androidx.appcompat.widget.AppCompatTextView 与 API < 26 不兼容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56422300/

36 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com