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

55,804

Solution 1

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 2

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

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.

Share:
55,804
Jonas
Author by

Jonas

Passionated Software Developer interested in Distributed Systems

Updated on November 18, 2020

Comments

  • Jonas
    Jonas over 3 years

    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

  • Jonas
    Jonas over 13 years
    The android.jar seems to be in my Build path. I have already tried with Clean but it doesn't help. I get the same errors when I create new projects.
  • Jonas
    Jonas over 13 years
    If I look in the Properties for my project, under "Java Build Path" there is a message: Unable to get system library for project. I think this is the problem, but I don't know how to fix it.
  • CommonsWare
    CommonsWare over 13 years
    @Jonas: Go into Window > Preferences > Android and make sure your SDK is still configured with the appropriate directory.
  • Jonas
    Jonas over 13 years
    I was wrong, I just get this error on old projects and not on new projects and the old doesn't seem to have an android.jar in the build path, but a message Unable to get system library for project.
  • CommonsWare
    CommonsWare over 13 years
    @Jonas: You might get that if you have your project configured for some target that you no longer have on the system (e.g., you removed it as part of your round of upgrades). In the project properties dialog, go into the Android area and make sure you have a valid target checked.
  • Jonas
    Jonas over 13 years
    Thanks, that fixed most of the problems. No target were selected. But I use MapView from Google Maps in one project, and I don't have a target with Google Maps API.
  • velazcod
    velazcod over 13 years
    Update your ADT on eclipse, they just pushed a new version to deal with some bugs: twitter.com/#!/romainguy/status/12222143299330050
  • Jonas
    Jonas over 13 years
    I actually fixed this problem as CommonsWare described. And now I upgraded to ADT 8.0.1 and got the same problems again, but his fix solved it again.
  • Thomas Ahle
    Thomas Ahle almost 13 years
    For me too, but with the addition that selecting a version in the Androids simply unset itself after reopening the preferences.
  • Thiago Cardoso
    Thiago Cardoso over 12 years
    I had this same problem and I solved it with @CommonsWare comment (the 3rd one).
  • Nilesh Gawade
    Nilesh Gawade over 12 years
    after that clean the project and then try to run it
  • acedanger
    acedanger over 11 years
    @CommonsWare's comment resolved it for me as well. Thank you!
  • Robin Davies
    Robin Davies over 11 years
    Worked for me. The project was referencing SDK 9 (which wasn't installed). When I edited the android version in the UI, the checkboxes wouldn't stay checked. Editing project.properties fixed things and allowed me to select the correct SDK version.
  • Carl
    Carl over 11 years
    Yes, this actually re-created the entry for (in my case) Android 2.2 in my Java Build Path, which had been replaced by "unable to get system library for the project" after I installed a number of items. Now everything works as before.
  • gonzobrains
    gonzobrains about 11 years
    @CommonsWare You are a true Android Patriot! Suddenly all my errors disappeared in one fell swoop! Thanks!
  • n611x007
    n611x007 over 10 years
    ticking in one of the boxes in <project> -> Properties -> Android -> Project Build Target did it. There was none selected. Strange. I've also copied android-support-v4.jar to a freshly-created <project's root>/libs folder - don't know if it has to do with anything because in itself it didn't help, but then the tick did.
  • Andrew
    Andrew about 10 years
    This is held under Project/Properties (not Settings) on my version of Eclipse. The solution (changing Android 4.3 Build Target from unchecked to checked) worked for me, but I don't understand how it became unchecked - the project worked fine earlier and seemed to stop working without any significant change.
  • zungnv
    zungnv about 10 years
    Thanks, it works. Somehow it lost the path to android.jar, just uncheck and check again , it will work
  • n611x007
    n611x007 over 9 years
    what information should have been given, so it wouldn't be "limited" any more?
  • n611x007
    n611x007 over 9 years
    I had a target selected, out of the three I'd installed, but selected a different one anyway, applied, then selected the original one and applied. then build. it fixed for me. just like Iker Martin's answer
  • Kristy Welsh
    Kristy Welsh over 8 years
    I also just closed and then reopened the project then everything worked.
  • Neeraj Krishna
    Neeraj Krishna over 8 years
    Worked for me too on Android 6.0