Android 无法解析目标“Google Inc.:Google APIs:16”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12567256/
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
Unable to resolve target 'Google Inc.:Google APIs:16'
提问by Sergey
I experience this problem when I added another project from internet. I think it asks me to use another version of target android. But I want that my app will work in android 2.2.
当我从互联网添加另一个项目时,我遇到了这个问题。我认为它要求我使用另一个版本的目标 android。但我希望我的应用程序可以在 android 2.2 中运行。
But it doesn't require API-8, it requires API-16 and I m not sure what I should do.
但它不需要 API-8,它需要 API-16,我不确定我应该做什么。
回答by Samuel
Modify the AndroidManifest.xml file so that any versions in there are Android 2.2. Also change the version of the SDK used by right clicking the project in eclipse and go to properties->android and change the version to 2.2. Some things might break though. Usually the version declared in the manifest is declared because the project uses SDK features only available for that version or later.
修改 AndroidManifest.xml 文件,以便其中的任何版本都是 Android 2.2。还要通过在eclipse中右键单击项目并转到properties->android并将版本更改为2.2来更改使用的SDK版本。不过,有些事情可能会破裂。通常声明在清单中声明的版本是因为项目使用仅适用于该版本或更高版本的 SDK 功能。
回答by Nick
Your app will still work on older versions even if you are targeting newer version. The target is what version you have tested your app to work on. If you target the most recent version (API 16), then your app will not be put in 'compatibility mode' when running on older phones. For example, if you have a menu button in 2.x but you target API 16, this menu button will not show up on certain phones since you're supposed to be using the ActionBar
.
即使您的目标是更新版本,您的应用程序仍可在旧版本上运行。目标是您测试应用程序的版本。如果您的目标是最新版本 (API 16),那么您的应用在旧手机上运行时将不会处于“兼容模式”。例如,如果您在 2.x 中有一个菜单按钮,但您的目标是 API 16,则此菜单按钮将不会显示在某些手机上,因为您应该使用ActionBar
.
The minSdkVersion
is what you are thinking of, which will make sure your app runs on older versions:
这minSdkVersion
就是您所想的,这将确保您的应用程序在旧版本上运行:
<uses-sdk android:minSdkVersion="8" />
So the solution to your problem is just to download the newest API level through the SDK Manager. You most likely just don't have API 16 installed.
因此,解决您的问题的方法就是通过 SDK Manager 下载最新的 API 级别。您很可能只是没有安装 API 16。