android - 我可以将 targetSdkVersion 设置为小于 minSdkVersion 吗?

标签 android target-sdk android-min-sdk

我需要 Android API 级别 11 的功能,但如果我将 targetSdkVersion 设置为 10,那么我会得到我想要的旧式菜单(带有菜单按钮)。设置这些值是否“合法”,或者 targetSdkVersion 是否必须高于或等于 minSdkVersion?

(注:好像有用!)

最佳答案

作为document说到 android:targetSdkVersion,

An integer designating the API Level that the application targets. If not set, the default value equals that given to 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).

无论如何,targetSdkVersion 应该始终大于或等于 minSdkVersion,因为您的应用绝不能在 minSdkVersion 以下运行。如果你设置的 targetSdkVersion 小于 minSdkVersion 这意味着你告诉 android 系统你已经在 targetSdkVersion 上测试了这个应用程序,但是这不可能(因为您的应用程序只能在低至 minSdkVersion 的设备上运行)。

因此矛盾 targetSdkVersion 应该总是大于等于 minSdkVersion

关于android - 我可以将 targetSdkVersion 设置为小于 minSdkVersion 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31935803/

相关文章:

android - 升级后 android Lollipop 设备上的权限问题

java - 为什么 Android Studio lint 无法识别我的 minSdkVersion

android - Flutter项目中 "flutter.minSdkVersion"的值在哪里初始化?

android - 将 void* 转换为字节数组

android - 应用不适用于平板电脑

android - 从日历中获取事件

android - 如何删除 Android M 中所有应用的应用缓存?

android - BLE 使用哪个 targetSDK?