Android 在 Eclipse 中更改 SDK 版本?无法解析目标 android-x
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3614190/
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
Android change SDK version in Eclipse? Unable to resolve target android-x
提问by wuntee
I developed an Android aplication against 2.1 SDK. Since then I have re-installed Eclipse/Android SDK; with the new install, I want to 'upgrade' the dependancy of the Android application to 2.2 SDK (because I dont want 2.1 installed on my machine). Is this possible? I am getting the following error from eclipse:
我针对 2.1 SDK 开发了一个 Android 应用程序。从那以后我重新安装了 Eclipse/Android SDK;通过新安装,我想将 Android 应用程序的依赖“升级”到 2.2 SDK(因为我不想在我的机器上安装 2.1)。这可能吗?我从 Eclipse 中收到以下错误:
[2010-08-31 18:18:32 - AndroidApplication] Unable to resolve target 'android-7'
回答by fufux
If you're using eclipse you can open default.properties
file in your workspace and change the project target to the new sdk (target=android-8
for 2.2). I accidentally selected the 1.5 sdk for my version and didn't catch it until much later, but updating that and restarting eclipse seemed to have done the trick.
如果您使用的是 eclipse,则可以default.properties
在工作区中打开文件并将项目目标更改为新的 sdk(target=android-8
对于 2.2)。我不小心为我的版本选择了 1.5 sdk,直到很久之后才发现它,但是更新它并重新启动 eclipse 似乎已经成功了。
回答by Ravindra singh
go to project properties and change the target from 7 to 8 also change the target in android manifest and also go to properties of project by right clicking on the project and choose the target
转到项目属性并将目标从 7 更改为 8 还要更改 android manifest 中的目标,并通过右键单击项目并选择目标来转到项目的属性
回答by 1''
This can happen when you mistakenly import an Android project into your Eclipse workspace as a Java project. The solution in this case: delete the project from the workspace in the Package Explorer, then go to File -> Import -> Android -> Existing Android code into workspace.
当您错误地将 Android 项目作为 Java 项目导入 Eclipse 工作区时,就会发生这种情况。这种情况的解决方法:从Package Explorer中的workspace中删除项目,然后去File -> Import -> Android -> Existing Android code into workspace。
回答by terry noah
I faced the same issue and got it working.
我遇到了同样的问题并让它工作。
I think it is because when you import a project, build target is not set in the project properties which then default to the value used in manifest file. Most likely, you already have installed a later android API with your SDK.
我认为这是因为当您导入项目时,未在项目属性中设置构建目标,然后默认为清单文件中使用的值。很可能,您已经使用 SDK 安装了更高版本的 android API。
The solution is to enable build target toward your installed API level (but keep the minimum api support as specified in the manifest file). TO do this, in project properties, go to android, and from "Project Build Target", pick a target name.
解决方案是为您安装的 API 级别启用构建目标(但保持清单文件中指定的最低 api 支持)。为此,在项目属性中,转到 android,然后从“项目构建目标”中选择一个目标名称。
回答by vimal krishna
In Build: v22.6.2-1085508 ADT you need to add(select Android 4.4.2)
在 Build: v22.6.2-1085508 ADT 中需要添加(选择 Android 4.4.2)
Goto project --> properties --> Android(This is second in listed item order leftPanel) and in the RightPanel Project Build Target, select Android 4.4.2 as Target name and apply changes It will rebuild the workspace.
转到项目 --> 属性 --> Android(这是列出的项目顺序 leftPanel 中的第二个)并在 RightPanel 项目构建目标中,选择 Android 4.4.2 作为目标名称并应用更改它将重建工作区。
In my case unable to resolve target 'android-17'eclipse was being shown as compile error and in code: import java.util.HashMap was not being referenced.
在我的情况下,无法解析目标 'android-17'eclipse 被显示为编译错误,并且在代码中:未引用导入 java.util.HashMap。
回答by KaranR
This Problem is because of Path so you need to build the path using following Steps
这个问题是因为 Path 所以你需要使用以下步骤构建路径
Goto project ----->Right Click on Project Name ---->properties ---->click on Than Java Build Pathoption than ---> click Android 4.2.2---->Ok
转到项目 -----> 右键单击项目名称 ----> 属性 ----> 单击 Than Java Build Path选项比 ---> 单击 Android 4.2.2 ---->Ok
回答by abdulqadeer
Goto project -->properties --> (in the dialog box that opens goto Java build path), and in order and export select android 4.1 (your new version) and select dependencies.
转到项目 --> 属性 --> (在打开转到 Java 构建路径的对话框中),并按顺序和导出选择 android 4.1(您的新版本)并选择依赖项。