Android 应用和兼容性

Android App and Compatibility

Android 项目的哪些部分导致设备不兼容?

我的第一个项目发布了,挺简单的。根据 do Google Play.

,它仅适用于 6880 设备

我女朋友的 phone 是不兼容的,尽管我通过 .apk 文件直接安装时她总是使用这个应用程序。

清单:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="my.project" android:installLocation="auto" android:versionCode="1" android:versionName="1.0">
  <application android:label="AppName" android:icon="@drawable/icon" android:allowBackup="true" android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:hardwareAccelerated="true">
    <activity android:name="my.project.AppName" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|mnc|mcc|locale|fontScale|uiMode" android:label="Credito">
      <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
    </activity>
  </application>
  <!-- Android 2.3.3 -->
  <uses-sdk android:minSdkVersion="9" android:targetSdkVersion="14" />
  <!-- OpenGL ES 2.0 -->
  <uses-feature android:glEsVersion="0x00020000" />
  <!-- USB support -->
  <uses-feature android:name="android.hardware.usb.host" />
  <!-- Disable screen compatibility modes -->
  <supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" />

  <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

</manifest>

here 中描述的设备兼容性。一般包括3个部分: * 设备功能; * 平台版本 * 屏幕配置;

根据您的清单,可能存在以下问题:

  1. "android.hardware.usb.host" - 应用需要保证支持 USB 主机 API 的设备。根据 official documentation:

因为并非所有 Android 供电的设备都保证支持 USB 主机 API,请包含一个 "uses-feature" 元素,声明您的应用程序使用 android.hardware.usb.host功能。

这基本上意味着该应用程序甚至可以在 phone 上运行(例如通过直接安装),直到调用此类 API 的那一刻。

  1. android:minSdkVersion="9" android:targetSdkVersion="14"

你女朋友的 phone 有没有早于 Android 2.3.3(比如 2.2)的东西?再一次,这并不意味着它不会工作,它只是意味着如果调用任何在 Android 2.3 之前不存在的方法,它可能会在她的 phone 上失败。

  1. 使用功能 android:glEsVersion="0x00020000"

这应该不是问题,因为:

OpenGL ES 2.0 - 此 API 规范受 Android 2.2(API 级别 8)及更高版本支持。

  1. 屏幕分辨率也应该不是问题,因为您已经打开了所有 4 种可能的主要分辨率。