【问题标题】:Nexus 5 , Galaxy S5 and some other devices are showing not compatible in Google playNexus 5、Galaxy S5 和其他一些设备在 Google Play 中显示不兼容
【发布时间】:2016-04-08 15:22:17
【问题描述】:

我已经在 google play 中发布了一个应用程序,并且某些设备显示为不受支持,例如 Nexus 5、Galaxy S5 等等。

我在我的 AndroidManifest.xml 中提到了仅适用于小尺寸和正常尺寸屏幕的过滤器,如以下链接中所建议的那样

http://developer.android.com/guide/practices/screens-distribution.html#FilteringHandsetApps

    <!-- all small size screens -->
    <screen
        android:screenDensity="ldpi"
        android:screenSize="small" />
    <screen
        android:screenDensity="mdpi"
        android:screenSize="small" />
    <screen
        android:screenDensity="hdpi"
        android:screenSize="small" />
    <screen
        android:screenDensity="xhdpi"
        android:screenSize="small" />
    <!-- all normal size screens -->
    <screen
        android:screenDensity="ldpi"
        android:screenSize="normal" />
    <screen
        android:screenDensity="mdpi"
        android:screenSize="normal" />
    <screen
        android:screenDensity="hdpi"
        android:screenSize="normal" />
    <screen
        android:screenDensity="xhdpi"
        android:screenSize="normal" />
</compatible-screens>

有人可以建议还需要添加什么来获得支持列表中的设备,我怀疑这些设备的密度更高。

【问题讨论】:

  • 根据this,Nexus 5 是xxhdpi。
  • Nexus 5 和三星 S5 是 xxhdpi 密度设备。

标签: android galaxy incompatibility s5


【解决方案1】:

我刚刚遇到了类似的问题。我想发布一个只能在智能手机上下载的应用。稍后我将介绍平板电脑支持。所以我需要一个过滤器,让我的应用程序仅适用于智能手机。该应用无法安装在 Nexus 5 或 Galaxy S5 上。

为了解决这个问题,我按照dev documentation (screen distribution) 中的建议进行了操作(另请参阅answer on stackoverflow):

<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>

但这还不够。 某些 xxhdpi 设备将不受支持。您可能想复制/粘贴最后一行并添加“xxhdpi”,但 tt 不起作用(我刚刚测试过,APK 签名失败并出现以下错误:“错误 APT0000:不允许字符串类型(在 'screenDensity'值为 'xxhdpi')") ;)

要支持 xxhdpi,请查看dev documentation (compatible screens element)。

注意:此属性目前不接受 xxhdpi 作为有效 值,但您可以指定 480 作为值,即 xhdpi 屏幕的近似阈值。

因此需要添加480,而不是xxhdpi,如下:

<screen android:screenSize="small" android:screenDensity="480" />
<screen android:screenSize="normal" android:screenDensity="480" />

现在,回到不支持的 Nexus 5 和 Galaxy S5。让我们检查一些规格:

LG Nexus 5:http://www.gsmarena.com/lg_nexus_5-5705.php

  • 屏幕尺寸为 4.95 英寸。
  • 密度:445 ppi

三星 Galaxy S5:http://www.gsmarena.com/samsung_galaxy_s5-6033.php

  • 屏幕尺寸:5.1 英寸
  • 密度:432 ppi

所以根据dev documentation (screen support):

图 1. Android 如何大致映射实际大小和 密度到广义尺寸和密度(数字不准确)。

正如您在上图中所见,4 到 5 英寸之间有点“棘手”(如果我错了请评论),因为屏幕可以是“正常”或“大”。所以基本上为了安全起见,我不得不添加对大型的支持:

<screen android:screenSize="large" android:screenDensity="ldpi" />
<screen android:screenSize="large" android:screenDensity="mdpi" />
<screen android:screenSize="large" android:screenDensity="hdpi" />
<screen android:screenSize="large" android:screenDensity="xhdpi" />
<screen android:screenSize="large" android:screenDensity="480" />

我刚刚在 Play 商店进行了测试,我的同事拥有 Nexus 5 能够下载该应用程序。像这样,无论如何,一些小型平板电脑或平板电脑(屏幕尺寸在 4 到 7 英寸之间)仍然可以下载我的应用程序,但至少 最新的超大屏幕平板电脑(大于7 英寸)不会。就我而言,这是可以接受的……希望这会有所帮助……

...如果我对 4 到 5 英寸之间的区域有误,请发表评论,这对我来说不是很清楚。哪个是正常的还是大的……

【讨论】:

    【解决方案2】:

    尝试在清单中包含&lt;supports-screens&gt; 元素,因为&lt;compatible-screens&gt; 定义了您的应用支持的特定屏幕,但&lt;supports-screens&gt; 定义了您的应用支持的屏幕的较低阈值(即更大的屏幕也支持)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-12-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多