NotificationCompat cannot be resolved to a type

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.