Android教程網
  1. 首頁
  2. Android 技術
  3. Android 手機
  4. Android 系統教程
  5. Android 游戲

排查 Android 應用被 Google Play 過濾顯示「不支援」的原因

編輯:關於 Android 程式設計

某天突然發現自己的應用被 Google Play 標示為「不支援 Google Nexus 7」,著實讓人有些苦惱。經過一番排查,歸納出以下幾種常見的可能原因,記錄下來供遇到類似問題的開發者參考。

原因一:攝像頭權限與硬體特性

Nexus 7 只有前置攝像頭。如果你的應用在清單中申請了相機權限:

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

那麼為了讓 Nexus 7 也能安裝,需要明確告訴系統相機並非必要特性,透過 uses-feature 將 required 設為 false:

<uses-feature android:name="android.hardware.camera" android:required="false" />

原因二:compatible-screens 的 dpi 設定

如果你在清單中透過 <compatible-screens> 明確列舉了支援的螢幕尺寸與密度組合,那麼只要某個裝置的 dpi 不在你列出的清單中,它就會被過濾掉。例如清單中涵蓋了 normal、large、xlarge 三種尺寸搭配 ldpi、mdpi、hdpi、xhdpi 等密度:

<compatible-screens>
    <screen android:screenSize="normal" android:screenDensity="mdpi"/>
    <screen android:screenSize="normal" android:screenDensity="hdpi"/>
    <screen android:screenSize="large"  android:screenDensity="mdpi"/>
    <!-- ... 其餘組合 ... -->
</compatible-screens>

問題就在於,Nexus 7 的 dpi 並非上述清單中的任何一項——它的 dpi 值約為 213(介於 tvdpi 與 xhdpi 之間)。既然不在列舉範圍內,自然也就被 Google Play 判定為不支援而過濾掉了。

解決思路

最直接的辦法,是不要使用 <compatible-screens> 去硬性限定支援清單,讓系統依據 <supports-screens> 或預設規則來判斷;或者,在設定 compatible-screens 時把 Nexus 7 對應的密度(約 213)一併補上。一般來說,除非有明確理由,否則不建議輕易使用 compatible-screens 鎖定裝置範圍,以免無端流失潛在使用者。

  1. 上一篇文章:
  2. 下一篇文章:
Copyright © Android教程網 All Rights Reserved