简体   繁体   English

Android Studio导入错误的程序包

[英]Android Studio is importing the wrong packages

I recently migrated to Android Studio, but it still isn't polished (in my opinion). 我最近迁移到Android Studio,但仍不完善(我认为)。 When I was making a call to a new thread and trying to get a callback to the UI thread, it suddenly complained that there was no post method in the Handler class. 当我调用一个新线程并尝试回调UI线程时,它突然抱怨Handler类中没有post方法。

Then I noticed that the IDE had imported java.util.logging.Handler instead of android.os.Handler . 然后我注意到IDE导入了java.util.logging.Handler而不是android.os.Handler Has anyone encountered this same problem before and how do you get Android Studio to import properly? 之前有人遇到过同样的问题吗?如何正确导入Android Studio?

是的,我遇到了同样的问题,但是简单地在使用自动完成时,按Ctrl + 空格键两次(检查您的键盘映射) ,它将显示所有已将其包命名为Handler的类,并选择适当的类

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM