简体   繁体   English

如果我使用的目标SDK版本是21,我可以在API 23上运行我的应用程序吗

[英]Can I run my app on API 23 if target SDK version I used is 21

I have developed an Android App having API 21 as target SDK version. 我已经开发了一个以API 21作为目标SDK版本的Android应用。

Will it run fine on API above it, for example, API 23? 它可以在上面的API(例如API 23)上正常运行吗?

It is perfectly ok to use a targetSdkVersion and install it on a device that has a greater SDK version. 可以使用targetSdkVersion并将其安装在具有更高SDK版本的设备上。

The targetSdkVersion that you specified in your build.gradle tells the system that you have developed and tested your app to work on that SDK. 您在build.gradle中指定的targetSdkVersion告诉系统您已经开发并测试了您的应用程序才能在该SDK上运行。 If the user installs your app on a greater SDK it is the system responsibility to provide backwards compatibility (if anything has changed). 如果用户在更高的SDK上安装您的应用,则系统责任是提供向后兼容性(如果发生任何更改)。

A good example is what happened with the permissions on SDK 23. Since that version it is necessary to explicitly request for dangerous permissions in code, just declaring the permission in the manifest is no longer sufficient. 一个很好的例子就是SDK 23上的权限发生了什么。由于该版本必须在代码中显式地请求危险的权限,仅在清单中声明权限已不再足够。

However, if you target this app to SDK22, it is not required to request explicitly by code, and if you install this app on a greater SDK system, it will work, because of the backward compatibility, which in this case is to accept all the permissions at install time. 但是,如果将此应用程序定向到SDK22,则不需要通过代码明确请求,并且如果将此应用程序安装在更大的SDK系统上,则由于向后兼容(在这种情况下将接受所有安装时的权限。

According to Uses SDK 根据用途SDK

android:targetSdkVersion 机器人:targetSdkVersion

An integer designating the API Level that the application targets. 一个整数,指定应用程序针对的API级别。 If not set, the default value equals that given to minSdkVersion. 如果未设置,则默认值等于给minSdkVersion的默认值。 This attribute informs the system that you have tested against the target version and the system should not enable any compatibility behaviors to maintain your app's forward-compatibility with the target version. 此属性通知系统您已经针对目标版本进行了测试,并且系统不应启用任何兼容性行为来维持应用程序与目标版本的前向兼容性。 The application is still able to run on older versions (down to minSdkVersion). 该应用程序仍然可以在较旧的版本(最低为minSdkVersion)上运行。

It could also help you to know this 它也可以帮助您了解这一点

android:minSdkVersion 安卓的minSdkVersion

An integer designating the minimum API Level required for the application to run. 一个整数,指定运行应用程序所需的最低API级别。 The Android system will prevent the user from installing the application if the system's API Level is lower than the value specified in this attribute. 如果系统的API级别低于此属性中指定的值,则Android系统将阻止用户安装应用程序。 You should always declare this attribute. 您应该始终声明此属性。

Your minSdkVersion is certainly below the API 21 . 您的minSdkVersion当然低于API 21 So, your application does work on above SDK versions (including the API 23 ). 因此,您的应用程序确实可以在以上SDK版本(包括API 23 )上运行。

You're good with that, no worries :) 你很好,不用担心:)

PS: Check this link targetSDKVersion to learn more about target SDK use purpose. PS:单击此链接targetSDKVersion可以了解有关目标SDK使用目的的更多信息。

暂无
暂无

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

相关问题 如何使用Ionic 3为Android API 21构建APK? 即使我在config.xml中将目标sdk更改为21,它仍会为API 23进行构建 - How do I build apk for android API 21 using Ionic 3? It keeps building for API 23 even though I changed the target sdk to 21 in config.xml 如果我的目标SDK设置为android 2.2(froyo),我可以在android API 14上运行我的android应用程序吗? - Can i run my android application on android API 14 if my target sdk is set to android 2.2(froyo)? 对于Http和Name Value Pair描述的问题,我已从sdk编译version23降级为sdk 21,而我遇到了错误 - For Http and Name Value Pair depricated issues i have downgraded from sdk compile version23 to sdk 21 and i was having an error 此替代库不应使用低于目标SDK 23的版本(21) - this suport libary should not use a lower version (21) than the target SDK 23 降级Android SDK(api 23 - > api 21) - Downgrade Android SDK( api 23 -> api 21) 我可以定位未发布的SDK版本吗? - Can I target an unreleased SDK version? 当我设置目标API 8和最小sdk API 8时,它是否在Android版本4.2.2上运行 - Is it run on android version 4.2.2 when I set target API 8 and minimum sdk API 8 如何在Eclipse中将编译版本更改为api 23 android? - How can I change the compile version to api 23 android in eclipse? 我的目标SDK版本是26,但是当我将我的APK上传到Playstore时,该应用仅支持16至19的SDK - My target SDK version is 26 but when I upload my apk on playstore, app supports only SDK ranging 16 to 19 如果我想使用蓝牙和目标 SDK 31 但我的最低 SDK 是 23,我需要在 Android 上获得什么权限? - What permissions would I need on Android if I want to use Bluetooth and Target SDK 31 but my minimum SDK is 23?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM