Sauron
Sauron

Reputation: 6647

NotificationCompat cannot be resolved to a type

I am newer to Android and receive the error message: "NotificationCompat cannot be resolved to a type"

MinSDK=9, TargetSDK=18,

As of yet, all sources are very vague on how to resolve this issue and simply note: "update the JAR files".

What JARs do I need and where can I find them, so that this issue is resolved?

Upvotes: 8

Views: 26284

Answers (3)

J E Carter II
J E Carter II

Reputation: 1496

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.

Upvotes: 4

Kevin Krumwiede
Kevin Krumwiede

Reputation: 10288

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.

Upvotes: 3

Embattled Swag
Embattled Swag

Reputation: 1469

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.

Upvotes: 15

Related Questions