NotificationCompat cannot be resolved to a type

杀马特。学长 韩版系。学妹 提交于 2019-12-04 07:18:22

You need the support library. Here are the instructions on how to download them: http://developer.android.com/tools/support-library/setup.html

I needed to add "android-support-v4.jar" to my project to use the ActionBar.

Sometimes Eclipse gets hung up on this class, and no amount of cleaning and rebuilding will make it recognize that you have, in fact, added the support library and imported the correct class. I don't know why it always happens with this particular class. But the solution is to close and restart Eclipse.

From the support link (which has been updated)

With the release of Android 9.0 (API level 28) there is a new version of the support library called AndroidX

From the menu: Refactor > Migrate to AndroidX...

You will be prompted to back up your project to a zip. After that, a Refactor Preview will be shown in the console area. You should see a button "Do Refactor".

This will remove the error under the noted conditions. You may find some lines of code now report as deprecated after the refactor.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!