Android Studio : Suspending all threads took: 47.193ms

从来没有遇到过这种问题,发现app点击后无法跳转到页面,出现黑屏,甚至白屏。查了相关代码说是内存问题,但是不知道怎么解决
searched 10000messages,recent msg is { when=-44s186ms callback=androidx.core.content.res.ResourcesCompat$FontCallback$2 target=android.os.Handler }head message is { when=-55s239ms what=6 target=android.view.ViewRootImpl$ViewRootHandler }
searched 20000messages,recent msg is { when=-20s431ms callback=androidx.core.content.res.ResourcesCompat$FontCallback$2 target=android.os.Handler }head message is { when=-55s240ms what=6 target=android.view.ViewRootImpl$ViewRootHandler }
I/MessageQueue: searched 10000messages,recent msg is { when=-44s907ms callback=androidx.core.content.res.ResourcesCompat$FontCallback$2 target=android.os.Handler }head message is { when=-55s960ms what=6 target=android.view.ViewRootImpl$ViewRootHandler }
I/MessageQueue: searched 20000messages,recent msg is { when=-21s154ms callback=androidx.core.content.res.ResourcesCompat$FontCallback$2 target=android.os.Handler }head message is { when=-55s963ms what=6 target=android.view.ViewRootImpl$ViewRootHandler }
I/MessageQueue: searched 10000messages,recent msg is { when=-44s911ms callback=androidx.core.content.res.ResourcesCompat$FontCallback$2 target=android.os.Handler }head message is { when=-55s964ms what=6 target=android.view.ViewRootImpl$ViewRootHandler }

看起来您的进程中有一些线程正在运行,分配临时对象,ART必须对这些对象进行垃圾收集并挂起所有线程来完成这项工作。
即使在你离开应用程序后,也可以尝试跟踪后台可能仍在运行的内容。你也可以尝试使用Android Studio中的“分配跟踪器”来查找正在分配的对象——也许这会让你追踪到散乱的线程。

当我将改装响应对象扩展到RealmObject时,就会发生这种情况。我删除了RealmObject以改进响应。这对我有用。

您好,我是有问必答小助手,您的问题已经有小伙伴帮您解答,感谢您对有问必答的支持与关注!
PS:问答VIP年卡 【限时加赠:IT技术图书免费领】,了解详情>>> https://vip.csdn.net/askvip?utm_source=1146287632