"Unable to get system library for project" after I upgraded to Android SDK 2.3 and ADT 8.0

Today I upgraded to Android SDK 2.3 and I also upgraded the Eclipse Plugin Androi Developer Tools 8.0 (from 0.9.9). I also upgraded my Java Development Kit to 1.6_22.

Now in Eclipse I get many errors in all my Android projects.

The error messages are like:

The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files.

How can I fix this so I can use my Android projects again?

In the Build Path for these projects, I don't have any references to an android.jar but a message:

Unable to get system library for project


Solution 1:

For me, the problem was that in the Project settings - Android tab, I had no Android version selected.

Solution 2:

That is rather difficult to answer, given the limited information you have supplied. Here are some suggestions:

  • Make sure that an appropriate android.jar is in your build path, since that is where java.lang.Object would come from.

  • Do a Project > Clean, to make sure you have 1.6 .class files, in case that is part of the problem.

  • Try creating a new project from scratch and see if that works.

Solution 3:

I had this problem even though I had a valid target selected. I fixed it by changing to a different target, applying changes and then changing back. That seems to have sorted it.

Solution 4:

Project->Properties->Android : Select another Android Target (in my case Android 4.0.3) -> Apply changes. THEN select again your default Android Target, and that is all.

Hope this help.

Solution 5:

This problem was caused for my old projects on a new machine that did not have an older Android SDK installed.

To fix, simply go into project.properties and observe your old version number:

# Project target.
target=Google Inc.:Google APIs:3

Simply update the version number, like so:

# Project target.
target=Google Inc.:Google APIs:7

You will find that Eclipse then picks up the right SDK version and starts working.