12

当我上传新的 APK 文件时,我无法让我的 Manifest 文件与许多较新的手机兼容,但我不明白为什么。我正在全新的HTC Evo V上对其进行测试,但无论出于何种原因,该设备都不会出现在兼容性列表中。

我正在针对 API 17 进行编译,最低支持 API 10,因此应该包含绝大多数手机。

我试过的:

  • 删除所有权限;不用找了
  • 尝试制作不需要WIFI;不用找了
  • 删除installLocation以查看是否有所作为;不用找了
  • 甚至尝试添加小屏幕支持以查看它是否会出现;不用找了

我读过的:

我的清单文件:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.somecompany.appname"
      android:versionCode="10"
      android:versionName="1.0"
      android:installLocation="preferExternal">

    <!-- For expansion pack downloads -->
    <!-- Required to access Android Market Licensing -->
    <uses-permission android:name="com.android.vending.CHECK_LICENSE" />
    <!-- Required to download files from Android Market -->
    <uses-permission android:name="android.permission.INTERNET" />
    <!-- Required to keep CPU alive while downloading files (NOT to keep screen awake) -->
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <!-- Required to poll the state of the network connection and respond to changes -->
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <!-- Required to check whether Wi-Fi is enabled -->
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
    <!-- Required to read and write the expansion files on shared storage -->
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

    <uses-sdk android:minSdkVersion="10" android:targetSdkVersion="17"/>
    <supports-screens android:normalScreens="true"/>
    <supports-screens android:largeScreens="true"/>
    <supports-screens android:xlargeScreens="true"/>

    <compatible-screens>
        <screen android:screenSize="normal" android:screenDensity="mdpi" />
        <screen android:screenSize="large" android:screenDensity="hdpi" />
        <screen android:screenSize="xlarge" android:screenDensity="xhdpi" />
    </compatible-screens>                      
    <application android:icon="@drawable/icon" android:label="@string/app_name" android:allowBackup="false">
        <activity android:name="somecompany.appname.SplashScreen"
                  android:label="@string/app_name"
                  android:theme="@android:style/Theme.NoTitleBar"
                  android:screenOrientation="portrait">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name="somecompany.appname.SoundAndCallActivity" android:screenOrientation="portrait" android:theme="@android:style/Theme.NoTitleBar"/>
        <activity android:name="somecompany.appname.MainScreenActivity"   android:screenOrientation="portrait" android:theme="@android:style/Theme.NoTitleBar"/>
        <activity android:name="somecompany.appname.SettingsActivity"   android:screenOrientation="portrait" android:theme="@style/Theme.Transparent"/>
    </application>
</manifest>
4

1 回答 1

22

我想发布这个问题以及一个答案,因为我发现一开始就很难弄清楚。但是,这将我支持的设备数量从 499 更改为 1968。希望这将在未来帮助更多的人,因为这似乎是一个晦涩的话题。

技巧 1:没有显示更多设备的原因是,当您使用<compatible-screens>标签时,Google 会更积极地过滤。就我而言,我没有足够的不同屏幕尺寸和密度组合,所以它过滤掉了我遗漏的所有内容(参见下面的技巧 2)。

如果您只使用<supports-screens />标签,那么您将使更多设备能够找到您的应用程序。因此,请帮自己一个忙,并删除<compatible-screens>块中的所有其他标签。

您可以使用这样的简写形式:

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

引用原文章

如果设备屏幕尺寸和密度与“兼容屏幕”元素中的任何屏幕配置(由“屏幕”元素声明)不匹配,Google Play 会过滤应用程序。

警告:通常,您不应使用此清单元素。通过排除您未列出的所有屏幕尺寸和密度组合,使用此元素可以显着减少您的应用程序的潜在用户群。您应该改为使用“supports-screens”清单元素(如上表 1 中所述)来为您没有考虑替代资源的屏幕配置启用屏幕兼容模式。

技术 2:您可以使用的另一种技术是更具体地使用您的<compatible-screens>标签并摆脱<supports-screens />标签。您可以根据您的应用要求以及最新的设备分发编号做出这些决定。

在下面的示例中,我不想支持小屏幕或ldpi普通、大或 xlarge 屏幕的密度,所以我将它们排除在外。

<compatible-screens>
    <!-- all normal size screens -->
    <screen android:screenSize="normal" android:screenDensity="mdpi" />
    <screen android:screenSize="normal" android:screenDensity="hdpi" />
    <screen android:screenSize="normal" android:screenDensity="xhdpi" />
    <!-- all large size screens -->
    <screen android:screenSize="large" android:screenDensity="mdpi" />
    <screen android:screenSize="large" android:screenDensity="hdpi" />
    <screen android:screenSize="large" android:screenDensity="xhdpi" />
    <!-- all xlarge size screens -->
    <screen android:screenSize="xlarge" android:screenDensity="mdpi" />
    <screen android:screenSize="xlarge" android:screenDensity="hdpi" />
    <screen android:screenSize="xlarge" android:screenDensity="xhdpi" />
</compatible-screens>
于 2012-12-24T05:59:10.933 回答