I\'m a begginer with Android and currently stuck with the lession: http://developer.android.com/training/basics/firstapp/starting-activity.html
In the part C
I ran into the exact same problem. CTRL-SHIFT-o (organize imports) filled in the missing import for me.
SuppressLint annotation was added in API level 16. You need to either:
tools/support/annotations.jar
from your Android SDK to the project libs
.Your build target is NOT set to API Level 14 or higher. This is not a bug, please close this issue.
(In eclipse: Project => Properties => Android)
It works, if you set the line @SuppressLint("NewApi")
above the class declaration! (In this lesson, this line is positioned within onCreate
, and that doesn't work!)
Move your cursor over "SuppressLint", which will be underlined in red. Select the fix option "Fix project setup". From the popup list select "add archive 'annotations.jar'. Have a happy day.
ctrl+shift+O to import libraries and ctrl+s to save made the error go away for me.