[英]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系统上,则由于向后兼容(在这种情况下将接受所有安装时的权限。
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.