android - 什么是 E/AbstractTracker : Can't create handler inside thread that has not called Looper. prepare()?

标签 android multithreading android-looper

我过去曾遇到过这个问题,但我并没有想太多,因为我只是在尝试使用 IDE。
但是,我意识到当我创建一个全新的应用程序时也会出现该错误,即使我没有添加自己的代码,我仍然会收到此错误,任何帮助解决此问题将不胜感激。
到目前为止,我已经尝试在 UI 线程和异步线程上运行方法,但仍然没有运气。
错误:

E/AbstractTracker: Can't create handler inside thread that has not called Looper.prepare()

D/AppTracker: App Event: stop

E/AbstractTracker: Can't create handler inside thread that has not called Looper.prepare()

D/AppTracker: App Event: start

最佳答案

关于您在问题中使用的服务类型或功能的详细信息不足。

但是我观察到当您使用新的 SDK 并在 OnePlus One/2 上运行应用程序时会发生这种情况。

您需要使用较低的 SDK (<28) 并将最小 SDK 设置为 16。

此外,如果您使用 DeviceAdminPermission或任何内置接口(interface)接收Broadcast然后删除 UserHandler作为论据。此参数添加在 SDK 29 中它创建了一个单独的线程。

关于android - 什么是 E/AbstractTracker : Can't create handler inside thread that has not called Looper. prepare()?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45827646/

相关文章:

android - 提高 Android ListView 中的滚动平滑度

Android 在菜单项中使用 font-awesome 字体作为图标

android - 添加Google Play Services 9.0.0后Dex文件超过64k

安卓 "Only the original thread that created a view hierarchy can touch its views."

android - Nutiteq:ViewLabel:延迟按钮执行

java - 了解 UI 线程

Android - myLooper() 与 getMainLooper()

c++ - 使用 lambda 将可变参数转发给线程

c++ - wait_until 在主线程中的工作方式与主线程中的工作方式是否不同?由 小码哥发布于

c++ - Windows 的 AcquireSRWLockExclusive 是递归的吗?