java - 目标 android 4.1 适用于以前的版本?

标签 java android api target

我有一个看起来很愚蠢的问题,但我对此表示赞同...

我有一个适用于 Android 的应用程序,由于使用了 API,因此不得不将目标定位到 Android 4.1。

我怀疑该应用程序是否可以在系统低于 4.1 的 android 设备上运行?

在我的 list 文件中放入以下内容

<uses-sdk
         android: minSdkVersion = "8"
         android: targetSdkVersion = "16" />

我在我的android 2.3.6设备上测试过,运行正常,没有任何bug,其他版本也一样没有出现问题吗?

最佳答案

最低 SDK 版本

最低 SDK 版本是您可以在其上运行应用程序而不会导致问题的最低 API。

An integer designating the minimum API Level required for the application to run. 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. You should always declare this attribute.

-- <uses-sdk> Documentation

目标SDK版本

目标 SDK 版本简单地说明了您可以为您的应用程序使用哪些 API 的方法。

An integer designating the API Level that the application targets. ... 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).

-- <uses-sdk> Documentation

例子

例如,假设您使用 Display.getSize(Point) 在你的应用程序中。此方法仅适用于 API 13+,因此您必须以 13 或更高版本为目标。但是,如果您不在使用 API 12 或更低版本的设备上调用此方法,则不会遇到任何问题。

但是,假设您的应用要求您有权访问 Fragment s 及其方法(并且不想使用支持库)。然后,您必须的最低 SDK 级别为 11——否则,它会在低于该 API 级别的设备上崩溃。

简答

android:minSdkVersion="8"意味着您的应用程序可以在 Android 2.2+ 上使用。 android: targetSdkVersion="16"意味着无论何时编译您的应用程序,您都可以访问 Android 4.1+ 中的任何内容(但意味着旧设备可以使用这些功能)。

关于java - 目标 android 4.1 适用于以前的版本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14431749/

相关文章:

java - 来自服务器 Android Studio 的 jitpack.io 状态代码 521

java - 无法安装 Magnolia 数据模块(版本 2.3.0)

api - 无法使用 Parse Schema API 创建具有指针类型字段的类

android - Bitbucket 管道 INSTALL_PARSE_FAILED_NO_CERTIFICATES 问题

java - 安卓工作室 : where is the function list?

php - Laravel 和 oauth 2

winapi - 为商业应用程序 Hook Win32 API 的推荐方法是什么?

java - 发布构建失败

java - 启动 netbeans 时出错

android - 异步任务中的进度对话框未关闭