崩溃 - 材料设计 android 5.0

Posted

技术标签:

【中文标题】崩溃 - 材料设计 android 5.0【英文标题】:crash - material design android 5.0 【发布时间】:2014-12-27 04:45:10 【问题描述】:

我的应用程序有一个大问题。它崩溃了,我不知道为什么。

在我的应用程序中,我有一个 Activity 和一个 listview 和一个 customlistviewadapter 和第二个 Detailactivity。 我想添加来自 android Lollipop 的材料设计,这是我的问题。我在两个 Activities 之间添加了不错的 Activity Transaction。

我正在从列表视图中取出列表视图元素中的图片和标题,并使用SparseArray<Bitmap> 传输图片,使用intentActivityOptions 传输我的其余数据。

从我的第一个 ActivityDetailActivity 的交易工作正常。在我的DetailActivity 我必须加载更多数据,其中之一是描述。 描述文本有 \n 新行标签,有时还有 xhtml 标签。 为了摆脱 \n 标签,我使用了String mdesc = text.replace("\n", "<br />");

所以现在我只有 xhtml 标签,为了让它在我的 textview 中看起来不错,我使用了这一行 description.setText(Html.fromHtml(mdesc));

也可以像魅力一样工作,但如果我单击后退按钮,当描述中的字符数高于 ~3800 时,应用程序会崩溃。

这是我的日志:

A/art﹕ art/runtime/check_jni.cc:65] JNI DETECTED ERROR IN APPLICATION: JNI CallVoidMethodV called with pending exception 'java.lang.IllegalStateException' thrown in void android.os.MessageQueue.nativePollOnce(long, i
A/art﹕ art/runtime/check_jni.cc:65]     in call to CallVoidMethodV
A/art﹕ art/runtime/check_jni.cc:65]     from void android.os.MessageQueue.nativePollOnce(long, int)
A/art﹕ art/runtime/check_jni.cc:65] "main" prio=5 tid=1 Runnable
A/art﹕ art/runtime/check_jni.cc:65]   | group="main" sCount=0 dsCount=0 obj=0x737d5ec0 self=0xb5007800
A/art﹕ art/runtime/check_jni.cc:65]   | sysTid=31960 nice=-6 cgrp=apps sched=0/0 handle=0xb6f40ec8
A/art﹕ art/runtime/check_jni.cc:65]   | state=R schedstat=( 285569518384 174632061067 1598010 ) utm=17211 stm=11345 core=0 HZ=100
A/art﹕ art/runtime/check_jni.cc:65]   | stack=0xbe3ad000-0xbe3af000 stackSize=8MB
A/art﹕ art/runtime/check_jni.cc:65]   | held mutexes= "mutator lock"(shared held)
A/art﹕ art/runtime/check_jni.cc:65]   native: #00 pc 00004c58  /system/lib/libbacktrace_libc++.so (UnwindCurrent::Unwind(unsigned int, ucontext*)+23)
A/art﹕ art/runtime/check_jni.cc:65]   native: #01 pc 000034c1  /system/lib/libbacktrace_libc++.so (Backtrace::Unwind(unsigned int, ucontext*)+8)
A/art﹕ art/runtime/check_jni.cc:65]   native: #02 pc 0025918d  /system/lib/libart.so (art::DumpNativeStack(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, int, char const*, art::mirror::ArtMethod*)+84)
A/art﹕ art/runtime/check_jni.cc:65]   native: #03 pc 0023cd13  /system/lib/libart.so (art::Thread::Dump(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const+162)
A/art﹕ art/runtime/check_jni.cc:65]   native: #04 pc 000b1195  /system/lib/libart.so (art::JniAbort(char const*, char const*)+620)
A/art﹕ art/runtime/check_jni.cc:65]   native: #05 pc 000b18c5  /system/lib/libart.so (art::JniAbortF(char const*, char const*, ...)+68)
A/art﹕ art/runtime/check_jni.cc:65]   native: #06 pc 000b4b4d  /system/lib/libart.so (art::ScopedCheck::ScopedCheck(_JNIEnv*, int, char const*)+1324)
A/art﹕ art/runtime/check_jni.cc:65]   native: #07 pc 000bcf23  /system/lib/libart.so (art::CheckJNI::CallVoidMethodV(_JNIEnv*, _jobject*, _jmethodID*, std::__va_list)+42)
A/art﹕ art/runtime/check_jni.cc:65]   native: #08 pc 00060ad3  /system/lib/libandroid_runtime.so (???)
A/art﹕ art/runtime/check_jni.cc:65]   native: #09 pc 0007474d  /system/lib/libandroid_runtime.so (android::NativeDisplayEventReceiver::dispatchVsync(long long, int, unsigned int)+40)
A/art﹕ art/runtime/check_jni.cc:65]   native: #10 pc 00074915  /system/lib/libandroid_runtime.so (android::NativeDisplayEventReceiver::handleEvent(int, int, void*)+80)
A/art﹕ art/runtime/check_jni.cc:65]   native: #11 pc 00012545  /system/lib/libutils.so (android::Looper::pollInner(int)+484)
A/art﹕ art/runtime/check_jni.cc:65]   native: #12 pc 000125ed  /system/lib/libutils.so (android::Looper::pollOnce(int, int*, int*, void**)+92)
A/art﹕ art/runtime/check_jni.cc:65]   native: #13 pc 0007fb61  /system/lib/libandroid_runtime.so (android::NativeMessageQueue::pollOnce(_JNIEnv*, int)+22)
A/art﹕ art/runtime/check_jni.cc:65]   native: #14 pc 000b0de7  /data/dalvik-cache/arm/system@framework@boot.oat (Java_android_os_MessageQueue_nativePollOnce__JI+102)
A/art﹕ art/runtime/check_jni.cc:65]   at android.os.MessageQueue.nativePollOnce(Native method)
A/art﹕ art/runtime/check_jni.cc:65]   at android.os.MessageQueue.next(MessageQueue.java:143)
A/art﹕ art/runtime/check_jni.cc:65]   at android.os.Looper.loop(Looper.java:122)
A/art﹕ art/runtime/check_jni.cc:65]   at android.app.ActivityThread.main(ActivityThread.java:5221)
A/art﹕ art/runtime/check_jni.cc:65]   at java.lang.reflect.Method.invoke!(Native method)
A/art﹕ art/runtime/check_jni.cc:65]   at java.lang.reflect.Method.invoke(Method.java:372)
A/art﹕ art/runtime/check_jni.cc:65]   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
A/art﹕ art/runtime/check_jni.cc:65]   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
A/art﹕ art/runtime/check_jni.cc:65]
A/art﹕ art/runtime/runtime.cc:283] Runtime aborting...
A/art﹕ art/runtime/runtime.cc:283] Aborting thread:
A/art﹕ art/runtime/runtime.cc:283] "main" prio=9 tid=1 Native
A/art﹕ art/runtime/runtime.cc:283]   | group="" sCount=0 dsCount=0 obj=0x737d5ec0 self=0xb5007800
A/art﹕ art/runtime/runtime.cc:283]   | sysTid=31960 nice=-6 cgrp=apps sched=0/0 handle=0xb6f40ec8
A/art﹕ art/runtime/runtime.cc:283]   | state=R schedstat=( 285595822403 174647533456 1598201 ) utm=17213 stm=11346 core=1 HZ=100
A/art﹕ art/runtime/runtime.cc:283]   | stack=0xbe3ad000-0xbe3af000 stackSize=8MB
A/art﹕ art/runtime/runtime.cc:283]   | held mutexes= "abort lock" "mutator lock"(shared held)
A/art﹕ art/runtime/runtime.cc:283]   native: #00 pc 00004c58  /system/lib/libbacktrace_libc++.so (UnwindCurrent::Unwind(unsigned int, ucontext*)+23)
A/art﹕ art/runtime/runtime.cc:283]   native: #01 pc 000034c1  /system/lib/libbacktrace_libc++.so (Backtrace::Unwind(unsigned int, ucontext*)+8)
A/art﹕ art/runtime/runtime.cc:283]   native: #02 pc 0025918d  /system/lib/libart.so (art::DumpNativeStack(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, int, char const*, art::mirror::ArtMethod*)+84)
A/art﹕ art/runtime/runtime.cc:283]   native: #03 pc 0023cd13  /system/lib/libart.so (art::Thread::Dump(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const+162)
A/art﹕ art/runtime/runtime.cc:283]   native: #04 pc 0022c6a9  /system/lib/libart.so (art::AbortState::DumpThread(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, art::Thread*)+32)
A/art﹕ art/runtime/runtime.cc:283]   native: #05 pc 0022c94b  /system/lib/libart.so (art::AbortState::Dump(std::__1::basic_ostream<char, std::__1::char_traits<char> >&)+410)
A/art﹕ art/runtime/runtime.cc:283]   native: #06 pc 0022cb0b  /system/lib/libart.so (art::Runtime::Abort()+82)
A/art﹕ art/runtime/runtime.cc:283]   native: #07 pc 000a7269  /system/lib/libart.so (art::LogMessage::~LogMessage()+1360)
A/art﹕ art/runtime/runtime.cc:283]   native: #08 pc 000b1381  /system/lib/libart.so (art::JniAbort(char const*, char const*)+1112)
A/art﹕ art/runtime/runtime.cc:283]   native: #09 pc 000b18c5  /system/lib/libart.so (art::JniAbortF(char const*, char const*, ...)+68)
A/art﹕ art/runtime/runtime.cc:283]   native: #10 pc 000b4b4d  /system/lib/libart.so (art::ScopedCheck::ScopedCheck(_JNIEnv*, int, char const*)+1324)
A/art﹕ art/runtime/runtime.cc:283]   native: #11 pc 000bcf23  /system/lib/libart.so (art::CheckJNI::CallVoidMethodV(_JNIEnv*, _jobject*, _jmethodID*, std::__va_list)+42)
A/art﹕ art/runtime/runtime.cc:283]   native: #12 pc 00060ad3  /system/lib/libandroid_runtime.so (???)
A/art﹕ art/runtime/runtime.cc:283]   native: #13 pc 0007474d  /system/lib/libandroid_runtime.so (android::NativeDisplayEventReceiver::dispatchVsync(long long, int, unsigned int)+40)
A/art﹕ art/runtime/runtime.cc:283]   native: #14 pc 00074915  /system/lib/libandroid_runtime.so (android::NativeDisplayEventReceiver::handleEvent(int, int, void*)+80)
A/art﹕ art/runtime/runtime.cc:283]   native: #15 pc 00012545  /system/lib/libutils.so (android::Looper::pollInner(int)+484)
A/art﹕ art/runtime/runtime.cc:283]   native: #16 pc 000125ed  /system/lib/libutils.so (android::Looper::pollOnce(int, int*, int*, void**)+92)
A/art﹕ art/runtime/runtime.cc:283]   native: #17 pc 0007fb61  /system/lib/libandroid_runtime.so (android::NativeMessageQueue::pollOnce(_JNIEnv*, int)+22)
A/art﹕ art/runtime/runtime.cc:283]   native: #18 pc 000b0de7  /data/dalvik-cache/arm/system@framework@boot.oat (Java_android_os_MessageQueue_nativePollOnce__JI+102)
A/art﹕ art/runtime/runtime.cc:283]   at android.os.MessageQueue.nativePollOnce(Native method)
A/art﹕ art/runtime/runtime.cc:283]   at android.os.MessageQueue.next(MessageQueue.java:143)
A/art﹕ art/runtime/runtime.cc:283]   at android.os.Looper.loop(Looper.java:122)
A/art﹕ art/runtime/runtime.cc:283]   at android.app.ActivityThread.main(ActivityThread.java:5221)
A/art﹕ art/runtime/runtime.cc:283]   at java.lang.reflect.Method.invoke!(Native method)
A/art﹕ art/runtime/runtime.cc:283]   at java.lang.reflect.Method.invoke(Method.java:372)
A/art﹕ art/runtime/runtime.cc:283]   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
A/art﹕ art/runtime/runtime.cc:283]   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
A/art﹕ art/runtime/runtime.cc:283] Pending exception java.lang.IllegalStateException thrown by 'void android.os.MessageQueue.nativePollOnce(long, int):-2'
A/art﹕ art/runtime/runtime.cc:283] java.lang.IllegalStateException: Unable to create layer for TextView
A/art﹕ art/runtime/runtime.cc:283]   at void android.os.MessageQueue.nativePollOnce(long, int) (MessageQueue.java:-2)
A/art﹕ art/runtime/runtime.cc:283]   at android.os.Message android.os.MessageQueue.next() (MessageQueue.java:143)
A/art﹕ art/runtime/runtime.cc:283]   at void android.os.Looper.loop() (Looper.java:122)
A/art﹕ art/runtime/runtime.cc:283]   at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:5221)
A/art﹕ art/runtime/runtime.cc:283]   at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[], boolean) (Method.java:-2)
A/art﹕ art/runtime/runtime.cc:283]   at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:372)
A/art﹕ art/runtime/runtime.cc:283]   at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:899)
A/art﹕ art/runtime/runtime.cc:283]   at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:694)
A/art﹕ art/runtime/runtime.cc:283] Dumping all threads without appropriate locks held: thread list lock mutator lock
A/art﹕ art/runtime/runtime.cc:283] All threads:
A/art﹕ art/runtime/runtime.cc:283] DALVIK THREADS (52):
A/art﹕ art/runtime/runtime.cc:283] "main" prio=9 tid=1 Native
A/art﹕ art/runtime/runtime.cc:283]   | group="" sCount=0 dsCount=0 obj=0x737d5ec0 self=0xb5007800
A/art﹕ art/runtime/runtime.cc:283]   | sysTid=31960 nice=-6 cgrp=apps sched=0/0 handle=0xb6f40ec8
A/art﹕ art/runtime/runtime.cc:283]   | state=R schedstat=( 285618908185 174654076164 1598229 ) utm=17214 stm=11347 core=0 HZ=100
A/art﹕ art/runtime/runtime.cc:283]   | stack=0xbe3ad000-0xbe3af000 stackSize=8MB
A/art﹕ art/runtime/runtime.cc:283]   | held mutexes= "abort lock"
A/art﹕ art/runtime/runtime.cc:283]   native: #00 pc 00004c58  /system/lib/libbacktrace_libc++.so (UnwindCurrent::Unwind(unsigned int, ucontext*)+23)
A/art﹕ art/runtime/runtime.cc:283]   native: #01 pc 000034c1  /system/lib/libbacktrace_libc++.so (Backtrace::Unwind(unsigned int, ucontext*)+8)
A/art﹕ art/runtime/runtime.cc:283]   native: #02 pc 0025918d  /system/lib/libart.so (art::DumpNativeStack(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, int, char const*, art::mirror::ArtMethod*)+84)
A/art﹕ art/runtime/runtime.cc:283]   native: #03 pc 0023cd13  /system/lib/libart.so (art::Thread::Dump(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const+162)
A/art﹕ art/runtime/runtime.cc:283]   native: #04 pc 00245ea5  /system/lib/libart.so (art::ThreadList::DumpLocked(std::__1::basic_ostream<char, std::__1::char_traits<char> >&)+120)
A/art﹕ art/runtime/runtime.cc:283]   native: #05 pc 0022c8c1  /system/lib/libart.so (art::AbortState::Dump(std::__1::basic_ostream<char, std::__1::char_traits<char> >&)+272)
A/art﹕ art/runtime/runtime.cc:283]   native: #06 pc 0022cb0b  /system/lib/libart.so (art::Runtime::Abort()+82)
A/art﹕ art/runtime/runtime.cc:283]   native: #07 pc 000a7269  /system/lib/libart.so (art::LogMessage::~LogMessage()+1360)
A/art﹕ art/runtime/runtime.cc:283]   native: #08 pc 000b1381  /system/lib/libart.so (art::JniAbort(char const*, char const*)+1112)
A/art﹕ art/runtime/runtime.cc:283]   native: #09 pc 000b18c5  /system/lib/libart.so (art::JniAbortF(char const*, char const*, ...)+68)
A/art﹕ art/runtime/runtime.cc:283]   native: #10 pc 000b4b4d  /system/lib/libart.so (art::ScopedCheck::ScopedCheck(_JNIEnv*, int, char const*)+1324)
A/art﹕ art/runtime/runtime.cc:283]   native: #11 pc 000bcf23  /system/lib/libart.so (art::CheckJNI::CallVoidMethodV(_JNIEnv*, _jobject*, _jmethodID*, std::__va_list)+42)
A/art﹕ art/runtime/runtime.cc:283]   native: #12 pc 00060ad3  /system/lib/libandroid_runtime.so (???)
A/art﹕ art/runtime/runtime.cc:283]   native: #13 pc 0007474d  /system/lib/libandroid_runtime.so (android::NativeDisplayEventReceiver::dispatchVsync(long long, int, unsigned int)+40)
A/art﹕ art/runtime/runtime.cc:283]   native: #14 pc 00074915  /system/lib/libandroid_runtime.so (android::NativeDisplayEventReceiver::handleEvent(int, int, void*)+80)
A/art﹕ art/runtime/runtime.cc:283]   native: #15 pc 00012545  /system/lib/libutils.so (android::Looper::pollInner(int)+484)
A/art﹕ art/runtime/runtime.cc:283]   native: #16 pc 000125ed  /system/lib/libutils.so (android::Looper::pollOnce(int, int*, int*, void**)+92)
A/art﹕ art/runtime/runtime.cc:283]   native: #17 pc 0007fb61  /system/lib/libandroid_runtime.so (android::NativeMessageQueue::pollOnce(_JNIEnv*, int)+22)
A/art﹕ art/runtime/runtime.cc:283]   native: #18 pc 000b0de7  /data/dalvik-cache/arm/system@framework@boot.oat (Java_android_os_MessageQueue_nativePollOnce__JI+102)
A/art﹕ art/runtime/runtime.cc:283]   at android.os.MessageQueue.nativePollOnce(Native method)
A/art﹕ art/runtime/runtime.cc:283]   at android.os.MessageQueue.next(MessageQueue.java:143)
A/art﹕ art/runtime/runtime.cc:283]   at android.os.Looper.loop(Looper.java:122)
A/art﹕ art/runtime/runtime.cc:283]   at android.app.ActivityThread.main(ActivityThread.java:5221)
A/art﹕ art/runtime/runtime.cc:283]   at java.lang.reflect.Method.invoke!(Native method)
A/art﹕ art/runtime/runtime.cc:283]   at java.lang.reflect.Method.invoke(Method.java:372)
A/art﹕ art/runtime/runtime.cc:283]   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
A/art﹕ art/runtime/runtime.cc:283]   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
A/art﹕ art/runtime/runtime.cc:283]
A/art﹕ art/runtime/runtime.cc:283] "Heap thread pool worker thread 0" prio=9 tid=2 Native (still starting up)
A/art﹕ art/runtime/runtime.cc:283]   | group="" sCount=0 dsCount=0 obj=0x0 self=0xafe0e400
A/art﹕ art/runtime/runtime.cc:283]   | sysTid=31966 nice=0 cgrp=apps sched=0/0 handle=0xac5a1a00
A/art﹕ art/runtime/runtime.cc:283]   | state=S schedstat=( 879428 6643385 8 ) utm=0 stm=0 core=1 HZ=100
A/art﹕ art/runtime/runtime.cc:283]   | stack=0xb4847000-0xb4849000 stackSize=1020KB
A/art﹕ art/runtime/runtime.cc:283]   | held mutexes=
A/art﹕ art/runtime/runtime.cc:283]   native: #00 pc 00012e98  /system/lib/libc.so (syscall+28)
A/art﹕ art/runtime/runtime.cc:283]   native: #01 pc 000a9fa3  /system/lib/libart.so (art::ConditionVariable::Wait(art::Thread*)+98)
A/art﹕ art/runtime/runtime.cc:283]   native: #02 pc 0024714d  /system/lib/libart.so (art::ThreadPool::GetTask(art::Thread*)+64)
A/art﹕ art/runtime/runtime.cc:283]   native: #03 pc 002470e7  /system/lib/libart.so (art::ThreadPoolWorker::Run()+62)
A/art﹕ art/runtime/runtime.cc:283]   native: #04 pc 002479d5  /system/lib/libart.so (art::ThreadPoolWorker::Callback(void*)+60)
A/art﹕ art/runtime/runtime.cc:283]   native: #05 pc 000162e3  /system/lib/libc.so (__pthread_start(void*)+30)
A/art﹕ art/runtime/runtime.cc:283]   native: #06 pc 000142d3  /system/lib/libc.so (__start_thread+6)
A/art﹕ art/runtime/runtime.cc:283]   (no managed stack frames)
A/art﹕ art/runtime/runtime.cc:283]
A/art﹕ art/runtime/runtime.cc:283] "Heap thread pool worker thread 2" prio=9 tid=3 Native (still starting up)
A/art﹕ art/runtime/runtime.cc:283]   | group="" sCount=0 dsCount=0 obj=0x0 self=0xafb0e400
A/art﹕ art/runtime/runtime.cc:283]   | sysTid=31968 nice=0 cgrp=apps sched=0/0 handle=0xac5a1f00
A/art﹕ art/runtime/runtime.cc:283]   | state=S schedstat=( 739842 1013075 7 ) utm=0 stm=0 core=1 HZ=100
A/art﹕ art/runtime/runtime.cc:283]   | stack=0xb4645000-0xb4647000 stackSize=1020KB
A/art﹕ art/runtime/runtime.cc:283]   | held mutexes=
A/art﹕ art/runtime/runtime.cc:283]   native: #00 pc 00012e98  /system/lib/libc.so (syscall+28)
A/art﹕ art/runtime/runtime.cc:283]   native: #01 pc 000a9fa3  /system/lib/libart.so (art::ConditionVariable::Wait(art::Thread*)+98)
A/art﹕ art/runtime/runtime.cc:283]   native: #02 pc 0024714d  /system/lib/libart.so (art::ThreadPool::GetTask(art::Thread*)+64)
A/art﹕ art/runtime/runtime.cc:283]   native: #03 pc 002470e7  /system/lib/libart.so (art::ThreadPoolWorker::Run()+62)
A/art﹕ art/runtime/runtime.cc:283]   native: #04 pc 002479d5  /system/lib/libart.so (art::ThreadPoolWorker::Callback(void*)+60)
A/art﹕ art/runtime/runtime.cc:283]   native: #05 pc 000162e3  /system/lib/libc.so (__pthread_start(void*)+30)
A/art﹕ art/runtime/runtime.cc:283]   native: #06 pc 000142d3  /system/lib/libc.so (__start_thread+6)
A/art﹕ art/runtime/runtime.cc:283]   (no managed stack frames)

我无法添加整个 logcat,所以我将其余部分粘贴到了 pastebin。 pastebin 的链接是here。

感谢您的帮助!

【问题讨论】:

我也有同样的问题,你有没有向谷歌报告? 当崩溃发生时,请您粘贴一个您在TextView 中使用的约3800 个字符的示例字符串 仅供参考,我将此报告为 Android 中的错误:code.google.com/p/android/issues/… 我在尝试转换 Glide 加载的图像时遇到了这个问题。 【参考方案1】:

如果您查看日志,您可能会在堆栈跟踪正上方看到类似于以下内容的警告:

W/OpenGLRenderer﹕ Layer exceeds max. dimensions supported by the GPU (1080x5856, max=4096x4096)

场景动画通过创建目标场景的位图层来工作。 GPU 具有该层的最大容量。在 Nexus 5 上,这是 4096x4096。您的目标场景中有视图,导致图层太大,可能是由于大量的文本内容。这超出了 GPU 的容量,导致应用程序崩溃。在模拟器上不会出现这种情况的原因是主机 GPU 具有更大的内存。

解决方案

避免在过渡动画结束前创建高于 4096 的目标层。而是在过渡结束后加载您的内容。您可以通过实现TransitionListener interface 来监听过渡结束事件。这方面的一个例子可以在here 找到。然后,您可以加载您的内容。

【讨论】:

感谢您对此的提醒......当退出屏幕超过 4096 高度时,它似乎也发生在后退转换中......仍在挖掘。这似乎是唯一有趣的目前在网上回答这个问题。 这方面有什么进展吗?我设法通过 setVisibility(GONE) 使其工作到 TransitionListener onTransitionStart 上的部分视图并在 onTransitionEnd 上显示它,但它仍然在按下时崩溃。 Could not allocate texture for layer (fbo=13 1440x196) 这是我的堆栈跟踪的正上方 非常感谢 (y) 就我而言,我正在使用 React Native 并尝试创建这样的曲线 http://images.mobile-patterns.com/1439428157127-2015-08-12%2011.58.21.png 它崩溃了,因为我创建了一个非常大的圆圈来做曲线跨度> 【参考方案2】:

其他答案中指出的最佳解决方案是添加: android:transitionGroup="true" 到长视图(通常是某种类型的 ScrollView)。

对于过渡侦听器方法,不要忘记在没有共享动画时重新创建旋转视图。

【讨论】:

【参考方案3】:

由于我仍然需要支持低至 Android 版本 9 的所有内容,因此 android:transitionGroup="true"TransitionListener 都不适合我。我可以通过在 Activity 级别禁用硬件加速来防止该问题:

<activity android:hardwareAccelerated="false" />

在视图级别禁用它对我不起作用,但可能对其他人有用:

myView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);

【讨论】:

【参考方案4】:

我在 Genymotion、AndroidStudio 模拟器和几个真实设备中遇到了这个问题。

我的日志有点不同

(fbo=13 1440x196)

但这不是重点。

此问题发生在共享元素转换期间,主要原因是它正在预渲染目标活动(您的共享转换结束的地方)。

因此,如果此活动非常大(在我的情况下,有几个可滚动文本屏幕或带有图像的长网格),您将收到此错误。

解决方案:

对您的内容进行分页,一次加载不超过 1-1.5 个屏幕的内容。

这将显着减小共享元素转换期间预渲染的屏幕尺寸(每次都会预渲染,以便系统知道在转换后放置转换对象的位置)

【讨论】:

这根本不是解决方案。请改用 android:transitionGroup="true"。【参考方案5】:

我遇到了同样的问题,我找到了避免崩溃的方法。你可以直接把return-transition换成其他的而不是fade,比如:explode/move/slide/...

为此,您只需添加

<item name="android:windowReturnTransition">@android:transition/explode</item>

到您的应用程序主题文件。

【讨论】:

以上是关于崩溃 - 材料设计 android 5.0的主要内容,如果未能解决你的问题,请参考以下文章

使用 android 5.0 的三星 DatePicker 崩溃

Android Cordova 5.0+ 相机崩溃

尝试在 android 5.0 上使用 RecyclerView 时应用程序崩溃

Qt5 QGeoPositionInfoSource::createDefaultSource() 在 Android 5.0 上崩溃

应用程序如何检测状态栏颜色(Android 5.0 Lollipop)?

发布时的应用崩溃(材料主题问题)