间和QUOT差异;构建目标SDK"在Eclipse和Android:targetSdkVersion在AndroidManifest.xml中? [英] Difference between "Build Target SDK" in Eclipse and android:targetSdkVersion in AndroidManifest.xml?

查看:211
本文介绍了间和QUOT差异;构建目标SDK"在Eclipse和Android:targetSdkVersion在AndroidManifest.xml中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因为我导入现有的Andr​​oid项目到Eclipse中,我被要求选择一个SDK构建目标作为这一进程的一部分。

As I'm importing an existing Android project into Eclipse, I am asked to select an SDK build target as part of the process.

为什么我需要输入这些信息? 这是如何不同于安卓targetSdkVersion /安卓:?的minSdkVersion 的Andr​​oidManifest.xml

Why do I need to enter this information? How is this different from the android:targetSdkVersion/android:minSdkVersion values specified in AndroidManifest.xml?

例如,在谷歌IO示例应用程序,它AndroidManifest说安卓targetSdkVersion = 11 ,但自述说,Eclipse项目需要目标API级别13或更高版本,或编译会发生错误。

For example, in the Google IO sample app, its AndroidManifest says android:targetSdkVersion=11, but the README says the Eclipse project needs to target API level 13 or higher, or compile errors will occur.

推荐答案

机器人:的minSdkVersion 清单文件意味着市场将过滤装置较低的SDK

android:minSdkVersion in manifest file means that market will filter devices with lower sdk.

项目属性文件的目标=机器人-X 意味着Eclipse将不会允许使用的方法或类的SDK小于x高。它会告诉编译器错误。

target=android-x in project properties file means that Eclipse will not allow use methods or classes from sdk higher than x. It will show compiler errors.

您可以使用这样的:提供最小的版本清单中 - 取决于你的应用程序的关键功能。设置相同的值,项目属性。然后,如果你想使用的API的地方,从更高的软件开发工具包 - 养在项目属性值,并用保鲜检查code。如果设备API能做到这一点code:

You can use it like this: provide min version in manifest - depending on your app critical features. Set the same value to project properties. Then, if you want use somewhere APIs from higher SDKs - raise up value in project properties, and wrap code with check if device API can do this code:

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ECLAIR_MR1)
{
    // here you can use APIs, that appears in Android 2.1
}

这篇关于间和QUOT差异;构建目标SDK"在Eclipse和Android:targetSdkVersion在AndroidManifest.xml中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆