可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
I was working on an android tutorial and it wanted me to import the library from another project .The import worked and the project works correctly. But I noticed that doing that messed up several of my other projects (the ones that use Android 2.1) by apparently messing with the build path. Now instead of seeing "Google APIs [Android 2.1]" under the gen
folder I see "Unable to get system library for project"
.
I verified the following:
I right-clicked the project and went to Properties
I see that the correct Project Build Target is checked(Google APIs [Android 2.1]), but "Unable to get system library for project" is still shown above the assets folder and below gen and Android Dependencies. Cleaning all projects doesn't help.
How can I fix this problem?
is there a way to fix this issue globally or do I have to do it one by one?
回答1:
I had the same problem. Try
- Right click on your project
- Go to properties
- Click the Android section
- Select a different target api (assuming one is already selected, as mine was - otherwise, select the one you want and jump to step 9)
- Click OK
- Do steps 1-3 again
- Select your original target api
- Click OK
- Clean and build your project
Worked for me, anyway.
Derived the solution from:
"Unable to get system library for project" after I upgraded to Android SDK 2.3 and ADT 8.0
回答2:
Error in .classpath on your project. It not connect to android sdk. Fix it and clean project. :-)
回答3:
This happens when you are targetting an API version that for some reason is not mapped on your buildpath.
- See which is the version of the SDK you are pointing to at the project.properties file.
- Go to the SDK Manager at Window->Android SDK Manager
- Check the Android API item that matches the version you want to use, OR, click on the latest one and then update your project.properties file.
- Make sure your project build configuration is Project->"Build Automatically"
- Retsart Eclipse (claning and rebuilding may not refresh all the project properties)
回答4:
Borrowing from @Erhannis answer :
"
Right click on your project
Go to properties
Click the Android section
"
When I view the build target everything looked fine :
So I checked another build target , hit apply, and then re checked my original build target (Android 4.4.2) and re-hit apply. My project then compiled.
回答5:
For me the project.properties file was missing (it was code from a repo I checked out). So I just created one with this line:
target=android-20
After that, Erhannis' solution worked for me.
回答6:
Just for completing Erhannis answer: If you fixed the problem but it appears again when you restart Eclipse, then just go to the file local.properties
on your workspace folder and verify that the location of the Android SDK there is correct.
回答7:
At times, when only single Android SDK version is installed on your system, and if it gets changed either by un-installing / re-installing Eclipse, or otherwise (directly through SDK Manager), then this issue might crop up.
.
This is accompanied by the message like this on Eclipse console:
YourApp] Unable to resolve target 'android-22'
.
A simple workaround to this issue is:
- Open AndroidManifests.xml of the project, and in the:
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="21" />
change the targetSdkVersion to the one currently installed on your system
- Next, open the project.properties file and update
target=android-21
to your current SDK version
- Finally, clean and re-build the project
回答8:
Right Click on Project-> Select Android tools -> Select Fix Project Properties
This did the trick for me.
回答9:
You need to click on the menu icon with the Android sitting in the grey box with a white arrow pointing down "Opens the Android SDK Manager".
or, from the command line, run:
%ANDROID_HOME%\tools\android sdk