Android 无法在 eclipse ide 上获取项目的系统库

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12141906/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 09:52:05  来源:igfitidea点击:

unable to get system library for the project on eclipse ide

androideclipseandroid-intent

提问by Pandiyan Muthu

enter image description hereI 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 genfolder I see "Unable to get system library for project".

在此处输入图片说明我正在编写一个 android 教程,它希望我从另一个项目导入库。导入工作正常,项目工作正常。但是我注意到这样做显然会弄乱构建路径,从而弄乱了我的其他几个项目(使用 Android 2.1 的项目)。现在,gen我看到的文件夹下没有看到“Google APIs [Android 2.1]” "Unable to get system library for project"

I verified the following:

我验证了以下内容:

I right-clicked the project and went to PropertiesI 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.

我右键单击该项目并转到Properties我看到已检查正确的项目构建目标(Google API [Android 2.1]),但资产文件夹上方和gen 和 Android 下方仍显示“无法获取项目的系统库”依赖性。清理所有项目无济于事。

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?

我该如何解决这个问题?有没有办法在全球范围内解决这个问题,还是我必须一个一个地解决这个问题?

回答by Erhannis

I had the same problem. Try

我有同样的问题。尝试

  1. Right click on your project
  2. Go to properties
  3. Click the Android section
  4. Select a different target api (assuming one is already selected, as mine was - otherwise, select the one you want and jump to step 9)
  5. Click OK
  6. Do steps 1-3 again
  7. Select your original target api
  8. Click OK
  9. Clean and build your project
  1. 右键单击您的项目
  2. 转到属性
  3. 点击安卓版块
  4. 选择一个不同的目标 api(假设已经选择了一个,就像我的一样 - 否则,选择你想要的一个并跳到第 9 步)
  5. 单击确定
  6. 再次执行步骤 1-3
  7. 选择您的原始目标 api
  8. 单击确定
  9. 清理并构建您的项目

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

在我升级到 Android SDK 2.3 和 ADT 8.0 后,“无法为项目获取系统库”得出解决方案

回答by duongvanthai

Error in .classpath on your project. It not connect to android sdk. Fix it and clean project. :-)

项目中的 .classpath 错误。它没有连接到android sdk。修复它并清理项目。:-)

回答by Lucas Massuh

This happens when you are targetting an API version that for some reason is not mapped on your buildpath.

当您的目标 API 版本由于某种原因未映射到您的构建路径时,就会发生这种情况。

  1. See which is the version of the SDK you are pointing to at the project.properties file.
  2. Go to the SDK Manager at Window->Android SDK Manager
  3. 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.
  4. Make sure your project build configuration is Project->"Build Automatically"
  5. Retsart Eclipse (claning and rebuilding may not refresh all the project properties)
  1. 在 project.properties 文件中查看您指向的 SDK 版本。
  2. 转到 Window->Android SDK Manager 中的 SDK Manager
  3. 检查与您要使用的版本匹配的 Android API 项目,或者,单击最新版本,然后更新您的 project.properties 文件。
  4. 确保您的项目构建配置为 Project->"Build Automatically"
  5. Retsart Eclipse(清理和重建可能不会刷新所有项目属性)

回答by blue-sky

Borrowing from @Erhannis answer :

借用@Erhannis 的回答:

"
Right click on your project
Go to properties
Click the Android section
"

When I view the build target everything looked fine :

当我查看构建目标时,一切看起来都很好:

enter image description here

在此处输入图片说明

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.

所以我检查了另一个构建目标,点击应用,然后重新检查我的原始构建目标(Android 4.4.2)并重新点击应用。我的项目然后编译。

回答by bmaupin

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:

对我来说,project.properties 文件丢失了(它是我检出的一个 repo 中的代码)。所以我只是用这一行创建了一个:

target=android-20

After that, Erhannis' solutionworked for me.

在那之后,Erhannis 的解决方案对我有用

回答by CaroloMarcado

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.propertieson your workspace folder and verify that the location of the Android SDK there is correct.

只是为了完成 Erhannis 的回答:如果您解决了问题,但在您重新启动 Eclipse 时它又出现了,那么只需转到local.properties工作区文件夹中的文件并验证那里的 Android SDK 的位置是否正确。

回答by y2k-shubham

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:

有时,当您的系统上只安装了一个 Android SDK 版本时,如果通过卸载/重新安装 Eclipse 或其他方式(直接通过 SDK 管理器)对其进行了更改,则可能会出现此问题。. 这在 Eclipse 控制台上伴随着这样的消息:

YourApp] Unable to resolve target 'android-22'

. A simple workaround to this issue is:

. 此问题的简单解决方法是:

  1. Open AndroidManifests.xml of the project, and in the:
  1. 打开项目的AndroidManifests.xml,在:
<uses-sdk
   android:minSdkVersion="14"
   android:targetSdkVersion="21" />
<uses-sdk
   android:minSdkVersion="14"
   android:targetSdkVersion="21" />

change the targetSdkVersion to the one currently installed on your system

将 targetSdkVersion 更改为您系统上当前安装的版本

  1. Next, open the project.properties file and update

    target=android-21

  1. 接下来,打开 project.properties 文件并更新

    目标 = android-21

到您当前的 SDK 版本

  1. Finally, clean and re-build the project
  1. 最后,清理并重新构建项目

回答by Fenil

Right Click on Project-> Select Android tools -> Select Fix Project Properties

右键单击项目-> 选择 Android 工具-> 选择修复项目属性

This did the trick for me.

这对我有用。

回答by Nicholas Albion

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".

您需要单击菜单图标,Android 位于灰色框中,白色箭头指向“打开 Android SDK 管理器”。

Opens the Android SDK Manager

打开 Android SDK 管理器

or, from the command line, run:

或者,从命令行运行:

%ANDROID_HOME%\tools\android sdk