android:maxSDKVersion - 无法将 apk 上传到 alpha

android:maxSDKVersion - couldn't upload apk to alpha

我在将应用上传到 Play 商店时遇到问题。旧的“19”版本可用于 API 版本 10 及更高版本。新的“20”版本指定了 maxSDKVersion=22(不高于 Android 5.1)。 尝试上传“20”时出现错误消息:

"it is forbidden that a device upgrading from API levels in the range 10-22 to API levels in the range of 23+ should downgrade from version 20 to version 19, which could happen if...".

这种情况在documentation中明确说明:

...future versions of Android (beyond Android 2.0.1) will no longer check or enforce the maxSdkVersion attribute during installation or re-validation. Google play will continue to use the attribute as a filter, however, presenting users with applications available for download.

我们的应用程序无法在 Android 6 上正常运行,因此我们应该以某种方式阻止在这些设备上安装。

所以,Google 支持人员回答:

... The error message is stating that if a user updates the Android version on their device, the configuration of your APKs would cause them to become ineligible for the version they currently have.

To resolve this issue, always make sure the APK that supports the higher API level always has a higher version code. For example, if an APK with API levels 14 - 17 was version 3 then an APK with API level 18 would have to have version 4.

In other cases, you can simply remove the max SDK declaration from your app’s manifest. ...

并且无法在现有应用中添加 maxSDKVersion 限制。