【问题标题】:<supports-screens> tag in Multiple apk scenario in android<supports-screens> 标签在 android 中的多个 apk 场景中
【发布时间】:2014-11-02 22:01:48
【问题描述】:

在我的 android 应用程序中(android:minSdkVersion="13",android:targetSdkVersion="19") 我正在根据屏幕尺寸兼容性创建多个 apk。

在我给出的支持大型设备的 apk 清单中 -

<supports-screens android:smallScreens="false"
                  android:normalScreens="false"
                  android:largeScreens="true"
                  android:xlargeScreens="true"
                  android:requiresSmallestWidthDp="600" />

我想知道我应该在支持小型、普通和大型设备(其 sw 小于 600dp)的 apk 清单中定义什么标签。我阅读了开发人员 android 教程,它提到您还必须在支持小型普通设备的 apk 中设置 android:largeScreens="true",android:xlargeScreens="true"。我没有得到那部分。

此外,支持大型和超大型设备的 apk 的版本代码会更高,以便 google play 在下载应用程序时供用户首先检查该 apk。

注意 - 支持的最低 sdk 版本为 3.2。

PS:开发者 android 这么说 -

Caution: If you use the <supports-screens> element for the reverse scenario (when your application is not compatible with larger screens) and set the larger screen size attributes to "false", then external services such as Google Play do not apply filtering. Your application will still be available to larger screens, but when it runs, it will not resize to fit the screen. Instead, the system will emulate a handset screen size (about 320dp x 480dp; see Screen Compatibility Mode for more information). If you want to prevent your application from being downloaded on larger screens, use <compatible-screens>, as discussed in the previous section about Declaring an App is Only for Handsets.

这是什么意思?假设我为其他 apk 提供所有支持(所有大小)。然后 google play 将首先检查更高版本的清单,如果满足,它将为用户下载该版本,因为多个 apk 遵循规则,如果多个 apk apk 支持设备,然后首选更高版本的 apk。在这方面我对吗?

【问题讨论】:

    标签: android android-screen-support android-multiple-apk


    【解决方案1】:

    由于您的targetSdkVersion 大于11,因此您无需为true 设置任何属性——它们是默认设置。因此,您应该简单地将所有属性设置为 false,特定构建支持的目标屏幕尺寸除外。

    因此,您的 largeScreens 构建 supports-screens 将如下所示:

    <supports-screens android:smallScreens="false"
                      android:normalScreens="false"
                      android:largeScreens="true"
                      android:xlargeScreens="false" />
    

    smallScreens 构建将是:

    <supports-screens android:smallScreens="true"
                      android:normalScreens="false"
                      android:largeScreens="false"
                      android:xlargeScreens="false" />
    

    等等。 Google Play 允许上传多个 APK,并根据 supports-screen 属性自动过滤。更多内容:http://developer.android.com/google/play/filters.html

    但是,您应该注意 Google 发出的关于为不同屏幕构建多个 APK 的警告:

    注意:Android 系统为应用程序提供强大的支持 使用单个 APK 支持所有屏幕配置。你应该避免 创建多个 APK 以支持不同的屏幕,除非绝对 必要的,而是遵循支持多个屏幕的指南 使您的应用程序灵活,可以适应所有屏幕 单个 APK 的配置。 http://developer.android.com/google/play/publishing/multiple-apks.html

    【讨论】:

    • 感谢您的回答。但我的疑问是,对于第二个 apk,我想要我在清单中定义的 sw>=600dp 的设备。我是否还需要定义其他字段,例如 android:largeScreens ="true" 因为开发者android说只有当你想支持低于3.1的android版本时才需要定义这个
    • 还有如何仅根据设备的“sw”来区分设备
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-09-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多