9

If I run "lint ." inside project directory I get the expected warnings, but if I run it from inside eclipse I get nonsense errors and warnings, for example:

  • The resource R.array.settings_derivatives appears to be unused [in fact, it is used]
  • The x.y.z is not registered in the manifest [in fact, it is registered]
  • Call requires API level 3 (current min is 1): android.view.SurfaceView#isInEditMode [in fact minSdkVersion is set to 7]

edit: If I create a new workspace and import the existing projects I get the right errors

Bananeweizen
  • 21,797
  • 8
  • 68
  • 88
miniBill
  • 1,743
  • 17
  • 41
  • [Call requires API level 3](http://developer.android.com/reference/android/view/View.html#isInEditMode%28%29) is true. It't not about your target level but about the "since API 3" where that method was introduced. You can probably turn that warning off - it only makes sense if you want to port your app to a lower min level that you currently have – zapl Mar 24 '12 at 12:13
  • It's true, but it should not be reported, as I've set the minSdkVersion to 7. And it's not reported as a warning, rather, as an error... And my point is that the command line tool gives a different [correct] result – miniBill Mar 24 '12 at 12:36
  • First, make sure you are on the latest tools (R17) and the corresponding Eclipse plugin. If the problems persist, then create a sample project that reproduces the problem, then submit a bug report to http://b.android.com. I have not seen those particular messages occur before. – CommonsWare Mar 24 '12 at 12:40
  • Latest tools and Eclipse plugin. Will try and reproduce on a smaller project – miniBill Mar 24 '12 at 12:42
  • You are right - I misinterpreted that error / purpose of the check. Try `Project > Clean..`, that may help resolve issues. Btw: I have no warning on `isInEditMode`. These warning / error checkers get often confused if there is another error in your project like illegal xml syntax in your manifest. – zapl Mar 24 '12 at 12:51
  • Clean didn't solve, and no illegal xml. Although I do have a rather messy setup: Android project depends on android library depends on j2me project depends on another j2me project, so it wouldn't suprise me THAT much if it gets confused – miniBill Mar 24 '12 at 13:02
  • I tried reproducing on a new project and coulnd't. I'm now trying to strip the actual project to barebone to see what's wrong – miniBill Mar 24 '12 at 13:10
  • Switching workspace and importing the old projects caused the warnings to change. I guess it's probably some issue with stale files in my workspace – miniBill Mar 24 '12 at 13:25
  • I have the same problem, you can follow the issue status [here](http://code.google.com/p/android/issues/detail?id=27527) – rjam Mar 26 '12 at 13:11
  • Summary of Rick's link: A fix has been made and will be included in tools r20. – Chris Knight Apr 17 '12 at 22:58
  • @miniBill, After the bug fix, does the problem still persists? – Pacerier Nov 18 '14 at 02:26
  • @Pacerier I don't use Eclipse anymore, sorry – miniBill Nov 18 '14 at 05:49

4 Answers4

3

There seems to be an issue, when the project directory is not directly under the workspace directory.

As of today the bug should be fixed in release 20: http://code.google.com/p/android/issues/detail?id=27527

Edit:

If necessary you can make a softlink into the workspace.

keiki
  • 3,260
  • 3
  • 30
  • 38
3

The problem was solved by switching workspace to a fresh one. It probably was a problem with settings left over from previous lint versions

miniBill
  • 1,743
  • 17
  • 41
0

I solved the same problem using this:-

Right click on the project folder > Android tools > Clear Link Markers

"Run Android Lint" makes some markers and the markers cause this error.

Jainendra
  • 24,713
  • 30
  • 122
  • 169
-1

"Preference --> Android --> Lint Error Checking", search issues "NewApi", and you can see the settings.

This check scans through all the Android API calls in the application and warns about any calls that are not available on all versions targeted by this application (according to its minimum SDK attribute in the manifest).

If your code is deliberately accessing newer APIs, and you have ensured (e.g. with conditional execution) that this code will only ever be called on a supported platform, then you can annotate your class or method with the @TargetApi

Community
  • 1
  • 1
guanfei
  • 830
  • 6
  • 5