【问题标题】:<compatible-screens> excludes app from Nexus 5x in Google Play<compatible-screens> 从 Google Play 中的 Nexus 5x 中排除应用
【发布时间】:2016-01-26 08:49:58
【问题描述】:

我现在正在开发的应用在 Nexus 5x 的 Google Play 中不可见。 由于它不支持平板电脑,因此清单中有一个&lt;compatible-screens&gt; 部分(如documentation 中所建议的那样):

 <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" />
   <!-- XXHdpi Screen -->
    <screen android:screenSize="normal" android:screenDensity="480" />
    <!-- XXXHdpi Screen -->
    <screen android:screenSize="normal" android:screenDensity="560" />
    <screen android:screenSize="normal" android:screenDensity="640" />
</compatible-screens>

但我不能使用&lt;supports-screens&gt;,因为this(我需要从平板电脑中完全过滤掉该应用):

注意:如果您将&lt;supports-screens&gt; 元素用于相反的场景(当您的应用程序不兼容大屏幕时)并将大屏幕尺寸属性设置为“false”,则Google Play 等外部服务不适用过滤。您的应用程序仍可用于较大的屏幕,但在运行时,它不会调整大小以适应屏幕。相反,系统将模拟手机屏幕尺寸(大约 320dp x 480dp;有关更多信息,请参阅屏幕兼容模式)。如果您想阻止您的应用程序在更大的屏幕上被下载,请使用&lt;compatible-screens&gt;,如上一节有关声明应用程序仅适用于手机的部分所述。

除了在&lt;compatible-screens&gt;中添加密度为420的线之外,还有其他方法可以解决这个问题吗

【问题讨论】:

  • 为什么不能使用&lt;compatible-screens&gt;中带420的行?
  • 因为它不是一个解决方案,它是一个 hack。它会起作用,但是当下一个具有 x-xxhdpi 范围内其他密度的设备到达时,我也必须添加该设备的密度。
  • 不幸的是,谷歌在这个问题上并没有提供太多帮助。所以另一种可能的解决方案是添加&lt;uses-feature android:name="android.hardware.telephony" /&gt;,并手动排除少数带sim卡的平板电脑。
  • @MargaritaLitkevych,您找到解决此问题的方法了吗?我遇到了完全相同的问题 - 我们需要排除所有平板电脑,现在仅添加 420 是一种黑客行为,迟早会在另一台设备上崩溃。
  • @bartzy,不幸的是,我没有找到任何非黑客解决方案。正如this 所说,我们甚至不应该再使用 了,所以这是一个限制 :(

标签: android google-play android-manifest


【解决方案1】:

根据Google,Nexus 5X 的屏幕为 xxhdpi,但密度为 2,6。 所以 2,6 * 160 (mdpi) = 416,但根据 Android developers' site 接受的值为 420。 所以只需添加 &lt;screen android:screenSize="normal" android:screenDensity="420" /&gt;

更新:新的 5 英寸 Google Pixel 具有相同的密度,因此也适用相同的规则。

【讨论】:

  • 谢谢,但这不是我正在寻找的解决方案。是的,对于 Nexus 5x,这条线可以工作,但如果其他设备以 x-xxhdpi 范围内的其他密度到达怎么办?我正在寻找更通用的方法来解决此问题。
  • 在这种情况下,我建议更改问题或直接问另一个问题。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多