简体   繁体   English

android:minSdkVersion,android:targetSdkVersion和“target”之间的关系

[英]Relation between android:minSdkVersion, android:targetSdkVersion and “target”

So, I'm a little confused, I thought I understood the meaning of android:minSdkVersion , android:targetSdkVersion and target in project properties. 所以,我有点困惑,我以为我理解了android:minSdkVersionandroid:targetSdkVersion和项目属性中的target的含义。

Right now I got these set to: 现在我把这些设置为:

    android:minSdkVersion="7" 
    android:targetSdkVersion="13"

And: 和:

    target=android-15

in project->properties->Android->Project Build Target . project->properties->Android->Project Build Target

When I try to run this application application on a device with Android 2.3.3 installed, I see a red cross against the device name but the application runs fine on it none the less. 当我尝试在安装了Android 2.3.3的设备上运行此应用程序应用程序时,我看到设备名称的红叉,但应用程序运行正常。

What am I missing? 我错过了什么? If I'm building against 15, how is it running on android-7? 如果我正在建立反对15,它是如何在android-7上运行的? This confusion stated after I integrated AdMob into my app which states it require minimum SDK level 13. 在我将AdMob集成到我的应用程序中之后,这种混淆表明它需要最低的SDK级别13。

To describe one at a time: 一次描述一个:

  • android:minSdkVersion helps Google Play filter apps for the user based on their device. android:minSdkVersion可帮助Google Play根据用户为用户过滤应用。 For instance, with minSdkVersion="7", someone browsing with a device that only supports 6 won't see your app on Google Play, and thus won't download it, find it doesn't work, and leave a bad review :) 例如,使用minSdkVersion =“7”时,使用仅支持6的设备浏览的人将无法在Google Play上看到您的应用,因此无法下载,发现它无效,并留下错误的评论: )

  • android:targetSdkVersion is a signal to the device about which version of the API your app was tested against. android:targetSdkVersion是设备的信号,告知您的应用程序针对哪个版本的API进行了测试。 New behaviors are often available by default with new versions of the platform, for applications that target at least that version of the platform. 对于至少针对该平台版本的应用程序,默认情况下,新版本的平台通常可以使用新行为。 For instance, by setting your targetSdkVersion to 11 or higher, you get an overflow menu in the ActionBar (for Honeycomb and up devices) instead of the "legacy menu button of shame". 例如,通过将targetSdkVersion设置为11或更高,您可以在ActionBar(对于Honeycomb和up设备)中获得溢出菜单,而不是“遗留的羞耻菜单按钮”。

  • project.properties target is a signal to your local build system regarding which version of the platform you should be compiling your code against. project.properties target是一个向本地构建系统发出的信号,告知您应该编译代码的平台版本。 Generally it's best to just set this to whatever you have set for the targetSdkVersion. 通常,最好将其设置为您为targetSdkVersion设置的任何内容。

What am I missing? 我错过了什么? If I'm building against 15, how is it running on android-7? 如果我正在建立反对15,它是如何在android-7上运行的?

Android maintains backwards compatibility for just this reason. 出于这个原因,Android保持向后兼容性。 When you use API's that were added in version 15 of the platform, obviously they won't be there on a device running an an older device. 当您使用在平台版本15中添加的API时,显然它们不会在运行旧设备的设备上。

However, it's possible (and encouraged) to design your application in such a way as to take advantage of features added on new platforms, but "degrade gracefully" such that your application continues to run on older ones. 但是,可以(并鼓励)以这样的方式设计应用程序,以便利用在新平台上添加的功能,但“优雅地降级”,以便您的应用程序继续在较旧的应用程序上运行。 There's an Android Training lesson on just this topic, called Supporting Different Platform Versions . 这个主题有一个Android培训课程,称为支持不同的平台版本

android:minSdkVersion="7" means you can't run this app in devices under 2.1(API-7) . android:minSdkVersion="7"表示您无法在2.1(API-7)下的设备中运行此应用程序。 android:targetSdkVersion="13" the app is built targetting this API. android:targetSdkVersion="13"该应用程序是针对此API构建的。 the build target will be set to 13 and the methods and stuffs that are available till 13 will work. 构建目标将设置为13,并且可用的方法和内容将工作到13。

http://developer.android.com/guide/topics/manifest/uses-sdk-element.html http://developer.android.com/guide/topics/manifest/uses-sdk-element.html

android:targetSdkVersion="13" Indicates that this application has been build by keeping the sdk 13 as target, to use its feature to full potential android:targetSdkVersion =“13”表示通过将sdk 13保持为目标来构建此应用程序,以充分发挥其功能

android:minSdkVersion="7" indicates that it works on sdk 7 and above, but some of its features can be stripped down if certain features are not available in lower sdk. android:minSdkVersion =“7”表示它适用于sdk 7及更高版本,但如果某些功能在低级sdk中不可用,则可以删除其部分功能。 ie(less than sdk 13) 即(少于sdk 13)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 APP_PLATFORM,android:minSdkVersion和android:targetSdkVersion之间是什么关系? - What is the relation between APP_PLATFORM, android:minSdkVersion and android:targetSdkVersion? Android:minSdkVersion与targetSdkVersion之间的关系 - Android: Relationship between minSdkVersion and targetSdkVersion 设置正确的Android构建目标minSdkVersion,targetSdkVersion - setting the correct Android Build Target, minSdkVersion, targetSdkVersion Android SDK minSdkVersion 和 targetSdkVersion - Android SDK minSdkVersion and targetSdkVersion Android Studio minSdkVersion和targetSdkVersion警告 - Android Studio minSdkVersion and targetSdkVersion warning Android Studio minSdkVersion、targetSdkVersion和minSdk、targetSdk有什么区别? - Android Studio What is the difference between minSdkVersion, targetSdkVersion and minSdk, targetSdk? Android风格的应用程序minSdkVersion =“ 8” targetSdkVersion =“ 21” - Android style app minSdkVersion=“8” targetSdkVersion=“21” 使用targetSdkVersion为25和minSdkVersion 19构建Android应用程序 - Building an Android app with targetSdkVersion of 25 and minSdkVersion 19 适用于Android的哪个Java版本具有不同的minSdkVersion和targetSdkVersion - Which Java version for Android with different minSdkVersion and targetSdkVersion 不同的android:minSdkVersion和targetSdkVersion导致性能问题 - Different android:minSdkVersion and targetSdkVersion causing performance problems
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM