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

AndroidEclipseAdtAndroid Sdk-2.3

Android Problem Overview


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

Android Solutions


Solution 1 - Android

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

Solution 2 - Android

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 - Android

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 - Android

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 - Android

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.

Solution 6 - Android

No need to create a new project from scratch. If "Fix Project Properties" or "Add Library > Android Classpath Container" does not work, "project.properties" file might be missing in the root of your project folder. Add that file and set the Android target in the Project properties, re-add the Android Library, Fix Project Properties again, Android System Library should now be included in your project. Rebuilt, and you are good to go!

From my personal experience. For self documenting as well, since this happens quite often on me:

Eclipse Helios SR2
Android SDK R.20
Android NDK R8b
OSX 10.7.4

Solution 7 - Android

In my case the issue was related with the missing library path from the properties>android>library.

I cleared and re-entered the library paths in project.properties file

Solution 8 - Android

Had EXACT issue as the original Question! Had not done anything but close my project/Eclipse and was startled by all the errors upon reopening.

In my case I only needed to do was change/switch workspaces. o_O When I reselected my original workspace I then found everything was resolved and working again!

Solution 9 - Android

Please see your .classpath file, and see if all reference lib projects or src projects are added with correct path and name.

Solution 10 - Android

tl;dr: also check for stale SDK paths in the "local.properties" file.

Here's how I fixed it: I went through the answer given by Richard Le Mesurier, and also checked the path to the Android SDK in Window > Preferences > Android as mentioned by CommonsWare (since I did indeed change the SDK directory a while ago), however it still couldn't find it.

Then I noticed that I had a file called "local.properties" which referenced the old location for "sdk.dir". I changed that to the new location to match what was in Window > Preferences > Android. Then deselected the build target in Project > Properties > Android, hit Apply, re-selected it, and hit OK and cleaned the project. That worked! Thanks all!

Solution 11 - Android

i have also encoutered this and solve it by changing the android choice in project properties. My error is because the project can't find proper lib from the android SDK. Then fix the project using android fix tool in right click of project, clean it and then correct.

Solution 12 - Android

I had this problem come out of nowhere.

What worked for me was to right-click the project, select Android Tools, Add support Library..

It is the android.jar that is missing, and this restores it.

Solution 13 - Android

Another possible explanation is that Eclipse has forgotten its Android plugin. This can happen if you switch workspaces, as happened in my case. I tried to re-import an existing Android project, and it couldn't find the basic java system libraries, since it was pointing to the standard android jars. Reinstalling the android plugin (Help->Eclipse Marketplace, then search for "Android" and pick "Android Development Tools for Eclipse") fixes it.

Solution 14 - Android

I right clicked project and Closed it. Then reopened it. That fixed the problem.

Solution 15 - Android

In my case, ADT needed update (in Eclipse menu Help/Check for Updates, or Help/Install New Software). Check your ADT!

Solution 16 - Android

I tried several options mentioned here, but nothing worked. Then I rebooted my Ubuntu machine and started Eclipse again. Then everything was solved. Just reboot.

Solution 17 - Android

https://stackoverflow.com/questions/12073222/java-lang-object-cannot-be-resolved-in-eclipse

This problems started to appear recently for me after I upgraded ADT. As suggested above, when I uncheck+Apply/check+Apply project build target it would help , but the problem would come back eventually. So instead I just added android.jar explicitly to the build. This is the entry in the .classpath file

    <classpathentry kind="lib" path="/Applications/adt-bundle-mac-x86_64/sdk/platforms/android-19/android.jar"/>

This is more of a workaround as I would have to change it every time I change the SDK version, but at least no need to play with properties to get it to build when I restart Eclipse.

Solution 18 - Android

Try cleaning your project, that might help.

On eclipse, click on the menu item above called "Project", then click on "Clean Build". On that screen, check the checkbox that says "Clean projects selected below", select the project(s) that's giving you problems, and click Ok.

It will rebuild your project and that usually helps with strange eclipse errors like this.

Solution 19 - Android

Try to create new project like this then try it

Screenshot of 'New Android Project' window

Solution 20 - Android

In my case, my project.properties had android-8 listed as the target, which I didn't have installed.

Solution 21 - Android

my case was not created the right AVD

after AVD created, go to project Property and find Android, select the right SDK version and then go to JAVA Build Path, delete the library (Unable to get system library for project) and add android library.

Solution 22 - Android

The best way here as I tried before, is to create a new project and choose :

create a project from an existing source and choose the location of the android project that you want to import, then next, you will see the build target of android like : 2.3.3 or 2.1 ..

Just choose one of them then finish!

You are done! ..

Solution 23 - Android

Remove the folder libs in your project

Solution 24 - Android

Had the same issue (red erros all over my java source files) Solution was simple:

  • step 1. In the manifest file raise the version to android:minSdkVersion="8" (I created a new empty project and looked in it's manifest file) (it was originally android:minSdkVersion="4" because i want to support older android versions.)
  • step 2. right click the project and select Build
  • step 3. just to be safe: On the menu: Project Clean and check my project
  • step 4: finally I changed back In the manifest file to android:minSdkVersion="4" and it had no errors.

Hope it works for you.

Solution 25 - Android

In my case, The JRE went missing (disapear from Eclipse option).

All I did to fix this is re-add the JRE under Windows -> Preferences -> Java -> Installed JREs.

mine was located at /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home

Solution 26 - Android

The way that helped me.

  1. Take the following file from the working project: workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/Working-project-name/.indexes

  2. Replace the broken project file: workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/Broken-project-name/.indexes

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionJonasView Question on Stackoverflow
Solution 1 - AndroidRichard Le MesurierView Answer on Stackoverflow
Solution 2 - AndroidCommonsWareView Answer on Stackoverflow
Solution 3 - AndroidMarkView Answer on Stackoverflow
Solution 4 - AndroidIker MartinView Answer on Stackoverflow
Solution 5 - AndroidJim PayneView Answer on Stackoverflow
Solution 6 - AndroidZennichimaroView Answer on Stackoverflow
Solution 7 - AndroidDhir PratapView Answer on Stackoverflow
Solution 8 - AndroidAnthony De SouzaView Answer on Stackoverflow
Solution 9 - AndroidzahidView Answer on Stackoverflow
Solution 10 - AndroidphreakheadView Answer on Stackoverflow
Solution 11 - AndroidcedricliangView Answer on Stackoverflow
Solution 12 - AndroidMarmoyView Answer on Stackoverflow
Solution 13 - AndroidDaniel RiegelView Answer on Stackoverflow
Solution 14 - Androiduser2019773View Answer on Stackoverflow
Solution 15 - AndroidMSquareView Answer on Stackoverflow
Solution 16 - AndroidffonzView Answer on Stackoverflow
Solution 17 - AndroidboltunView Answer on Stackoverflow
Solution 18 - AndroidvelazcodView Answer on Stackoverflow
Solution 19 - AndroidNilesh GawadeView Answer on Stackoverflow
Solution 20 - AndroidMaxView Answer on Stackoverflow
Solution 21 - AndroidhihellView Answer on Stackoverflow
Solution 22 - AndroidAdlyView Answer on Stackoverflow
Solution 23 - AndroidJoanView Answer on Stackoverflow
Solution 24 - Androiduser3445991View Answer on Stackoverflow
Solution 25 - AndroidChristView Answer on Stackoverflow
Solution 26 - AndroidwindnnwView Answer on Stackoverflow