我们正在编写一个 Android 应用程序,我们计划在至少安装了 Froyo (API 8) 到 Jelly Bean (API 16) 的 Android 设备上提供该应用程序,但我们不想将其提供到 API 级别现在是 12 和 13,分别是 Honeycomb 3.1 和 3.2。
基本上,我们只是在避免使用 Android 平板电脑。有什么办法可以跳过这些操作系统吗? AndroidManifest.xml
文件有问题吗?
最佳答案
您不想跳过操作系统 :) 使用 < compatible-screens >在您的 list 中并限制为您支持的内容。
来自文档,
Specifies each screen configuration with which the application is compatible. Only one instance of the element is allowed in the manifest, but it can contain multiple elements. Each element specifies a specific screen size-density combination with which the application is compatible.
示例:
如果您的应用程序只兼容小屏幕和普通屏幕,而不管屏幕密度如何,那么您必须指定八个不同的元素,因为每个屏幕尺寸都有四种不同的密度配置。如果您的应用程序仅与小屏幕和普通屏幕兼容, list 条目如下所示:
<manifest ... >
...
<compatible-screens>
<!-- all small size screens -->
<screen android:screenSize="small" android:screenDensity="ldpi" />
<screen android:screenSize="small" android:screenDensity="mdpi" />
<screen android:screenSize="small" android:screenDensity="hdpi" />
<screen android:screenSize="small" android:screenDensity="xhdpi" />
<!-- all normal size screens -->
<screen android:screenSize="normal" android:screenDensity="ldpi" />
<screen android:screenSize="normal" android:screenDensity="mdpi" />
<screen android:screenSize="normal" android:screenDensity="hdpi" />
<screen android:screenSize="normal" android:screenDensity="xhdpi" />
</compatible-screens>
<application ... >
...
<application>
</manifest>
编辑: 澄清为什么你应该不使用<supports-screens>
而不是这个解决方案。
如果您使用 <supports-screens>
当您的应用程序不兼容大屏幕并将大屏幕尺寸属性设置为“false”时,Google Play 等外部服务不应用过滤元素。您的应用程序仍将可用到更大的屏幕,但是当它运行时,它不会调整大小以适应屏幕。相反,系统将模拟手机屏幕尺寸(大约 320dp x 480dp)。
底线:
If you want to prevent your application from being downloaded on larger screens, use
<compatible-screens>
关于android - 如何跳过或避免 list 中的 Android API 级别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11733284/