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

前端 未结 3 2027
有刺的猬
有刺的猬 2021-01-22 17:36

I have developed an Android App having API 21 as target SDK version.

Will it run fine on API above it, for example, API 23?

3条回答
  •  终归单人心
    2021-01-22 18:16

    It is perfectly ok to use a targetSdkVersion and install it on a device that has a greater SDK version.

    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. If the user installs your app on a greater SDK it is the system responsibility to provide backwards compatibility (if anything has changed).

    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.

    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.

提交回复
热议问题