Google Play控制台错误-无法升级到已安装的应用

问题描述:

我根据Google教程和示例开发了一个即时应用apk.当我尝试开始将产品投入生产时,我看到一个错误: 无法升级到已安装的应用

I developed an instant app apk basing on google tutorials and samples. When I'm trying to start rollout to production, I see one error: Non-upgradable to installed app

问题

此即时应用APK的某些用户将不符合您已安装应用中任何APK的条件.

解决方案

确保您的Instant App APK的定位与您的APK的定位相匹配.

项目结构: 有两种情况,第一种:

Project structure: There are two scenarios, 1st:

base-baseFeature,minSdk 18,targetSdk 26

base - baseFeature, minSdk 18, targetSdk 26

application project(':apk')
feature project(':item-details')

项目详细信息功能-minSdk 18,targetSdk 26

item-details feature - minSdk 18, targetSdk 26

api project(':base')

ui-即时模块,minSdk 18,targetSdk 26,模块中不包含所有视图的功能

ui - feature not included in instant module, minSdk 18, targetSdk 26, module contains all views

implementation project(':base')
other modules like customcomponents, shared etc

即时-即时应用模块minSdk 18或23,targetSdk 26

instant - instant app module minSdk 18 or 23, targetSdk 26

implementation project(':base')
implementation project(':item-details')

apk-apk模块,minSdk 18,targetSdk 26

apk - apk module, minSdk 18, targetSdk 26

implementation project(':ui')
implementation project(':shared')

第二种情况在baseFeature中具有项目详细信息代码.

Second scenario has item-details code in baseFeature.

即时应用程序正在Android Studio以及Google Play开发和预发行版本中运行.另外,当我尝试升级到已安装的应用程序时,一切正常. 我认为定位是正确的,但Google Play控制台却有不同的看法.

Instant app is running from Android Studio and from Google Play development and pre-release. Also when I'm trying to upgrade to installed app, everything works fine. In my opinion, targeting is correct but Google Play Console thinks differently.

您知道有关如何推广即时应用程序的任何想法吗?请帮忙 :( 我已经进行了3天的发布,无法发布该应用程序.

Do you know any ideas about how to rollout instant apps? Please help :( I've been working on this release for 3 days and I can not rollout app.

更新10.09.2017 APK详细信息:

Supported Android devices 8448 devices 
API levels 18+ 
Target SDK 26 
Screen layouts 4 screen layouts 
Localizations default + 113 languages 
Features 2 features 
Required permissions 12 permissions 
OpenGL ES versions 1.0+ 
OpenGL textures all textures 
Uploaded Sep 9, 2017, 7:57:11 AM PDT 

根据Android 文档:

According to the Android documentation:

您可以使用Android SDK中随附的aapt工具,根据声明的功能和权限来确定Google Play如何过滤您的应用程序.为此,请使用dump badging命令运行aapt.这会导致 aapt 解析您的应用程序清单,并应用与Google Play相同的规则来确定您的应用程序所需的功能.

You can use the aapt tool, included in the Android SDK, to determine how Google Play will filter your application, based on its declared features and permissions. To do so, run aapt with the dump badging command. This causes aapt to parse your application's manifest and apply the same rules as used by Google Play to determine the features that your application requires.

通过在可安装和即时应用apk上运行该命令,将显示以下信息.

By running that command on your installable and instant app apks the following info is printed.

可安装的应用(551版):

Installable app (version 551):

package: name='skyesoftware.blogspace' versionCode='551' versionName='0.3.1.551' platformBuildVersionName=''
sdkVersion:'18'
targetSdkVersion:'26'
uses-permission: name='android.permission.INTERNET'
uses-permission: name='android.permission.READ_EXTERNAL_STORAGE'
uses-permission: name='android.permission.WRITE_EXTERNAL_STORAGE'
uses-permission: name='android.permission.ACCESS_WIFI_STATE'
uses-permission: name='android.permission.ACCESS_NETWORK_STATE'
uses-permission: name='android.permission.RECEIVE_BOOT_COMPLETED'
uses-permission: name='android.permission.ACCESS_COARSE_LOCATION'
uses-permission: name='android.permission.ACCESS_FINE_LOCATION'
uses-permission: name='android.permission.WAKE_LOCK'
uses-permission: name='com.google.android.providers.gsf.permission.READ_GSERVICES'
uses-permission: name='com.google.android.c2dm.permission.RECEIVE'
uses-permission: name='skyesoftware.blogspace.permission.C2D_MESSAGE'
…
feature-group: label=''
  uses-feature: name='android.hardware.faketouch'
  uses-implied-feature: name='android.hardware.faketouch' reason='default feature for all apps'
  uses-feature: name='android.hardware.location'
  uses-implied-feature: name='android.hardware.location' reason='requested android.permission.ACCESS_COARSE_LOCATION permission, and requested android.permission.ACCESS_FINE_LOCATION permission'
  uses-feature: name='android.hardware.screen.portrait'
  uses-implied-feature: name='android.hardware.screen.portrait' reason='one or more activities have specified a portrait orientation'
  uses-feature: name='android.hardware.wifi'
  uses-implied-feature: name='android.hardware.wifi' reason='requested android.permission.ACCESS_WIFI_STATE permission'
…
supports-screens: 'small' 'normal' 'large' 'xlarge'
supports-any-density: 'true'
locales: '--_--' 'af' 'am' 'ar' 'az' 'az-AZ' 'be' 'be-BY' 'bg' 'bn' 'bn-BD' 'bs' 'bs-BA' 'ca' 'cs' 'da' 'de' 'el' 'en-AU' 'en-GB' 'en-IN' 'es' 'es-ES' 'es-US' 'et' 'et-EE' 'eu' 'eu-ES' 'fa' 'fi' 'fr' 'fr-CA' 'gl' 'gl-ES' 'gu' 'gu-IN' 'hi' 'hr' 'hu' 'hy' 'hy-AM' 'id' 'in' 'is' 'is-IS' 'it' 'iw' 'ja' 'ka' 'ka-GE' 'kk' 'kk-KZ' 'km' 'km-KH' 'kn' 'kn-IN' 'ko' 'ky' 'ky-KG' 'lo' 'lo-LA' 'lt' 'lv' 'mk' 'mk-MK' 'ml' 'ml-IN' 'mn' 'mn-MN' 'mr' 'mr-IN' 'ms' 'ms-MY' 'my' 'my-MM' 'nb' 'ne' 'ne-NP' 'nl' 'pa' 'pa-IN' 'pl' 'pt' 'pt-BR' 'pt-PT' 'ro' 'ru' 'si' 'si-LK' 'sk' 'sl' 'sq' 'sq-AL' 'sr' 'sr-Latn' 'sv' 'sw' 'ta' 'ta-IN' 'te' 'te-IN' 'th' 'tl' 'tr' 'uk' 'ur' 'ur-PK' 'uz' 'uz-UZ' 'vi' 'zh-CN' 'zh-HK' 'zh-TW' 'zu'
densities: '120' '160' '240' '320' '480' '640' '65534'

即时应用基本功能:

package: name='skyesoftware.blogspace' versionCode='1' versionName='1.0.0' platformBuildVersionName=''
sdkVersion:'18'
targetSdkVersion:'26'
uses-permission: name='android.permission.INTERNET'
uses-permission: name='android.permission.ACCESS_NETWORK_STATE'
uses-permission: name='android.permission.WAKE_LOCK'
uses-permission: name='com.google.android.c2dm.permission.RECEIVE'
uses-permission: name='skyesoftware.blogspace.permission.C2D_MESSAGE'
application: label='' icon=''
feature-group: label=''
  uses-feature: name='android.hardware.faketouch'
  uses-implied-feature: name='android.hardware.faketouch' reason='default feature for all apps'
other-activities
other-receivers
other-services
supports-screens: 'small' 'normal' 'large' 'xlarge'
supports-any-density: 'true'
locales: '--_--' 'af' 'am' 'ar' 'az' 'az-AZ' 'be' 'be-BY' 'bg' 'bn' 'bn-BD' 'bs' 'bs-BA' 'ca' 'cs' 'da' 'de' 'el' 'en-AU' 'en-GB' 'en-IN' 'es' 'es-US' 'et' 'et-EE' 'eu' 'eu-ES' 'fa' 'fi' 'fr' 'fr-CA' 'gl' 'gl-ES' 'gu' 'gu-IN' 'hi' 'hr' 'hu' 'hy' 'hy-AM' 'in' 'is' 'is-IS' 'it' 'iw' 'ja' 'ka' 'ka-GE' 'kk' 'kk-KZ' 'km' 'km-KH' 'kn' 'kn-IN' 'ko' 'ky' 'ky-KG' 'lo' 'lo-LA' 'lt' 'lv' 'mk' 'mk-MK' 'ml' 'ml-IN' 'mn' 'mn-MN' 'mr' 'mr-IN' 'ms' 'ms-MY' 'my' 'my-MM' 'nb' 'ne' 'ne-NP' 'nl' 'pa' 'pa-IN' 'pl' 'pt' 'pt-BR' 'pt-PT' 'ro' 'ru' 'si' 'si-LK' 'sk' 'sl' 'sq' 'sq-AL' 'sr' 'sr-Latn' 'sv' 'sw' 'ta' 'ta-IN' 'te' 'te-IN' 'th' 'tl' 'tr' 'uk' 'ur' 'ur-PK' 'uz' 'uz-UZ' 'vi' 'zh-CN' 'zh-HK' 'zh-TW' 'zu'
densities: '120' '160' '240' '320' '480' '640' '65534'

即时应用功能APK:

package: name='skyesoftware.blogspace' versionCode='1' versionName='1.0.0' split='blogspace_item_details' platformBuildVersionName=''
sdkVersion:'18'
targetSdkVersion:'26'
uses-permission: name='android.permission.INTERNET'
uses-permission: name='android.permission.ACCESS_NETWORK_STATE'
application: label='' icon=''
feature-group: label=''
  uses-feature: name='android.hardware.faketouch'
  uses-implied-feature: name='android.hardware.faketouch' reason='default feature for all apps'
other-activities
supports-screens: 'small' 'normal' 'large' 'xlarge'
supports-any-density: 'true'
locales: '--_--'
densities: '160'

如您所见,可安装的应用程序请求ACCESS_COARSE_LOCATIONACCESS_FINE_LOCATION权限,这些权限隐式添加android.hardware.location功能的要求.以同样的方式,ACCESS_WIFI_STATE权限暗含android.hardware.wifi功能.如果用户的设备上没有GPS或WiFi(听起来很奇怪,但是这种设备在野外存在),则无法将您的即时应用升级到可安装的应用.

As you can see your installable app requests the ACCESS_COARSE_LOCATION and ACCESS_FINE_LOCATION permissions which implicitly add a requirement of the android.hardware.location feature. In the same way the ACCESS_WIFI_STATE permission implied the android.hardware.wifi feature. A user who don't have either GPS or WiFi on their device (that sounds odd but such devices exist in the wild) will not be able to upgrade your instant app to the installable one.

android.hardware.screen.portrait功能是限制您可安装的应用程序可用性的另一件事,这是因为:

One more thing that limits your installable app availability is the android.hardware.screen.portrait feature, which was implied because:

一个或多个活动指定了纵向方向

one or more activities have specified a portrait orientation

要解决所有这些问题并使您的可安装应用对即时应用的所有用户可用,请在可安装应用的清单中(在<manifest>标记下方的级别上)添加以下代码块:

To fix all those issues and make you installable app available to the all users of the instant app, add the following block to the manifest of your installable app (on the level below the <manifest> tag):

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

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

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

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

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

android.hardware.location.networkandroid.hardware.location.gps功能符合以下要求:

如果您的应用程序针对Android 5.0(API级别21)或更高版本,并且使用ACCESS_COARSE_LOCATIONACCESS_FINE_LOCATION权限以便分别从网络或GPS接收位置更新,则还必须明确声明您的应用程序使用android.hardware.location.networkandroid.hardware.location.gps硬件功能.

If your app targets Android 5.0 (API level 21) or higher and uses the ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION permission in order to receive location updates from the network or a GPS, respectively, you must also explicitly declare that your app uses the android.hardware.location.network or android.hardware.location.gps hardware features.

 
顺便说一句,找出可安装应用程序需要哪些功能的另一种方法是

 
Btw, the other way to figure out what features are required by the installable app is the APK details info screen on the App releases section of the Google Play Console.