Android Play 商店报告“您的设备与此版本不兼容”,但它在 Nexus7 上通过 adb 安装得很好

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21484209/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 04:39:19  来源:igfitidea点击:

Play store reports "Your device isn't compatible with this version" but it installs via adb just fine on Nexus7

androidadbnexus-7google-play

提问by spartygw

I have an app I released to a private Google Play beta. I can install this exact same APK to my Nexus 7 just fine with

我有一个应用发布到私人 Google Play 测试版。我可以将这个完全相同的 APK 安装到我的 Nexus 7 上

adb pm install

adb pm install

but through the Google Play store it is marked for this exact same Nexus7 as

但是通过 Google Play 商店,它被标记为与 Nexus7 完全相同的

Your device isn't compatible with this version.

Your device isn't compatible with this version.

This is the sameapk. I can't figure out how to get any information on why the play store thinks it's not compatible.

这是同一个apk。我不知道如何获得有关 Play 商店认为它不兼容的原因的任何信息。

My manifest looks like this:

我的清单看起来像这样:

<uses-sdk android:minSdkVersion="10" />

<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-permission android:name="android.permission.CAMERA"></uses-permission>
<uses-permission android:name="android.permission.RECORD_AUDIO"></uses-permission>
<uses-permission android:name="android.permission.READ_PHONE_STATE"></uses-permission>
<uses-permission android:name="android.permission.WAKE_LOCK"></uses-permission>
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.GET_TASKS" />

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

<application android:icon="@drawable/icon" android:label="@string/app_name">
    <activity android:name=".foobar"
              android:label="@string/app_name"
              android:screenOrientation="portrait">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

    <service android:name=".fooservice" android:exported="false" android:enabled="true" android:label="@string/app_name" android:icon="@drawable/icon">
    </service>

</application>

Any help on determining why Google Play thinks it is not compatible?

关于确定 Google Play 认为它不兼容的原因有什么帮助吗?

采纳答案by fasteque

That's completely correct this behavior: please refer to the official documentation here http://developer.android.com/guide/topics/manifest/uses-feature-element.html.

这是完全正确的行为:请参阅此处的官方文档http://developer.android.com/guide/topics/manifest/uses-feature-element.html

That's the relevant part:

这是相关的部分:

Declared <uses-feature>elements are informational only, meaning that the Android system itself does not check for matching feature support on the device before installing an application. However, other services (such as Google Play) or applications may check your application's <uses-feature>declarations as part of handling or interacting with your application. For this reason, it's very important that you declare all of the features (from the list below) that your application uses.

声明的<uses-feature>元素仅供参考,这意味着 Android 系统本身不会在安装应用程序之前检查设备上的匹配功能支持。但是,<uses-feature>作为处理应用程序或与应用程序交互的一部分,其他服务(例如 Google Play)或应用程序可能会检查应用程序的声明。因此,声明应用程序使用的所有功能(来自下面的列表)非常重要。

So the fact you're able to install the apk through adb is not a proof for a particular device to be filtered off or not.

因此,您能够通过 adb 安装 apk 的事实并不能证明特定设备是否被过滤掉。

Also, check here: http://developer.android.com/guide/topics/manifest/uses-permission-element.html

另外,请在此处查看:http: //developer.android.com/guide/topics/manifest/uses-permission-element.html

In some cases, the permissions that you request through can affect how your application is filtered by Google Play.

在某些情况下,您请求的权限可能会影响 Google Play 过滤您的应用程序的方式。

If you request a hardware-related permission — CAMERA, for example — Google Play assumes that your application requires the underlying hardware feature and filters the application from devices that do not offer it.

如果您请求与硬件相关的权限(例如 CAMERA),Google Play 会假定您的应用程序需要底层硬件功能,并从不提供该功能的设备中过滤该应用程序。

Update:you've confirmed you're using the Nexus 7 2012, so please refer to this official blog post: http://android-developers.blogspot.ch/2012/07/getting-your-app-ready-for-jelly-bean.html.

更新:您已确认您使用的是 Nexus 7 2012,因此请参阅此官方博客文章:http: //android-developers.blogspot.ch/2012/07/getting-your-app-ready-for-果冻豆.html

Google states "apps requiring the android.hardware.camera feature will not be available on Nexus 7".

Google 声明“需要 android.hardware.camera 功能的应用程序将无法在 Nexus 7 上使用”。

If you need that permission because you use the camera in your app, you can do it programmatically as explained in http://developer.android.com/guide/topics/media/camera.html#detect-camera.

如果您因为在应用中使用摄像头而需要该权限,则可以按照http://developer.android.com/guide/topics/media/camera.html#detect-camera 中所述以编程方式进行操作。

回答by Gravitoid

This happened to my app a couple of times. It turned out the camera requirement was causing this error when the device user had never used the camera since purchase.

这发生在我的应用程序上几次。事实证明,当设备用户自购买以来从未使用过相机时,相机要求导致了此错误。

I change the camera requirement to not be required by the following:

我将相机要求更改为以下不需要:

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

回答by manuelvsc

You should read/follow this link from Reto Meier.

您应该阅读/关注Reto Meier 的链接

As said in the link from now on you need to specify your app features.

正如链接中所说,从现在开始,您需要指定您的应用程序功能。

Basically a quick solution is to run aapt dump badging {your apk}and verify which features your app is using. Then add the ones that do not affect your app usability to your manifest with required field set to false. e.g. <uses-feature android:name="android.hardware.camera" android:required="false" />

基本上,一个快速的解决方案是运行aapt dump badging {your apk}并验证您的应用程序正在使用哪些功能。然后将不影响您的应用程序可用性的那些添加到您的清单中,并将必填字段设置为 false。e.g. <uses-feature android:name="android.hardware.camera" android:required="false" />

That should be enough.

那应该就够了。

回答by Areeba Qurashi

This Can be Happen when you give unnecessary permissions.

当您授予不必要的权限时,可能会发生这种情况。

in my case, i use the permission

就我而言,我使用权限

uses-feature android:name="com.sec.feature.spen_usp" android:required="true"

使用功能 android:name="com.sec.feature.spen_usp" android:required="true"

When i remove this permission then it works Fine

当我删除此权限时,它可以正常工作