优化Android清单文件以获得最大数量的受支持设备

优化Android清单文件以获得最大数量的受支持设备,android,android-manifest,manifest,compatibility,android-compatibility,Android,Android Manifest,Manifest,Compatibility,Android Compatibility,当我上传一个新的APK文件时,我很难让我的清单文件和很多新手机兼容,我不明白为什么。我正在一个全新的设备上测试它,但无论出于什么原因,该设备都不会出现在兼容性列表中 我是根据API17进行编译的,至少支持API10,所以这应该包括绝大多数手机 我所尝试的: 删除所有权限;不变 尝试不需要WIFI;不变 已删除installLocation,以查看它是否有所不同;不变 甚至尝试添加小屏幕支持,看看它是否会出现;不变 我读到: 我的清单文件: <?xml version="1.

当我上传一个新的APK文件时,我很难让我的清单文件和很多新手机兼容,我不明白为什么。我正在一个全新的设备上测试它,但无论出于什么原因,该设备都不会出现在兼容性列表中

我是根据API17进行编译的,至少支持API10,所以这应该包括绝大多数手机

我所尝试的:

  • 删除所有权限;不变
  • 尝试不需要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>


我想发布这个问题,并给出一个答案,因为一开始我发现这让我很沮丧。然而,这将我支持的设备数量从499个更改为1968个。希望这将帮助更多的人在未来,因为这似乎是一个模糊的话题

技术1:没有更多设备出现的原因是,当你使用
标签时,谷歌的过滤更为积极。在我的例子中,我没有足够的不同的屏幕大小和密度组合,所以它过滤掉了我遗漏的所有屏幕(见下面的技术2)

如果您只使用
标签,那么您将能够让更多的设备找到您的应用程序。所以,帮自己一个忙,删除
块中的所有其他标记

您可以使用以下简称:

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

@Arash我刚刚进入Android世界,所以希望这也能帮助其他一些人。感谢你的提示,这真的很有帮助“这将我支持的设备数量从499变为1968”-@Iwasrobed你是如何得到这些数字的?当你上传一个新的APK到Google Play dev控制台时,这些数字会显示出来,@skatabenWait,我应该同时拥有支持屏幕和兼容屏幕吗?还是只有一个?为什么?谢谢你,伙计
<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>