致命异常:java.lang.IllegalStateException - 无法为 LinearLayout 创建图层(仅在 Galaxy j4+、j6+ 中崩溃)

Fatal Exception: java.lang.IllegalStateException - Unable to create layer for LinearLayout(Crashing in only Galaxy j4+, j6+)

Fatal Exception: java.lang.IllegalStateException Unable to create layer for LinearLayout, size 768x5440 max size 8192 color type 4 has context 1

android.os.MessageQueue.nativePollOnce (MessageQueue.java)
android.os.Looper.loop + 181 (Looper.java:181)
android.app.ActivityThread.main + 7097 (ActivityThread.java:7097)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.ZygoteInit.main + 975 (ZygoteInit.java:975)

我收到了来自 firebase Crashlytics 的 nativePollOnce.java 崩溃警报,但是在众多(galaxy j4+、j6+)模型中只有少数会经常崩溃。我是如何解决这个问题的?

看来 this issue is related - the first answer in that link that links to Scene transition with hero elements throws Layer exceeds max. dimensions supported by the GPU 对你有帮助。

我有这个错误,买了一个三星J4设备来解决它。 在我的例子中,有一个屏幕包含许多回收视图和嵌套滚动视图。 解决方案是删除“match_parent”并手动设置其中一个回收视图的大小(高度或宽度)。我认为这在某种程度上使 GPU 的计算更容易。