我将Instant-app发布到生产时收到错误消息。
我在这里读过这篇文章:You should have at least one active APK that is mapped to site 'sample.com' via a web 'intent-filter',这有点具体。
上述链接中的答案指出:
使用相同的HOST网络'intent-filter'上传可安装的APK in alpha,beta或production。
我上传了一个可安装的apk w / intent-filter to alpha,并且在将我的即时应用程序发布到预发布时错误消息消失了,但是当将即时应用程序发布到生产时我得到了同样的错误。
您应该至少有一个活动的APK通过网络'intent-filter'映射到网站'sample.com'。
我的可安装apk与default-url
intent-filter只上传到alpha。但是,当我尝试将我的即时应用程序推向生产时,我想知道我的可安装的apk w / intent-filter是否需要转移到生产中?
原因是因为安装和即时应用程序的相同轨道级别之间的行为需要相同。如果用户在下载即时应用程序后使用installed-app(没有正确的intent-filters),则用户将体验到不同的URL解析行为。
您必须将app-link添加到您的活动中。这是一个它看起来像的例子。
<activity
android:name=".GoodbyeActivity"
android:label="@string/title_activity_goodbye"
android:theme="@style/AppTheme">
<intent-filter
android:autoVerify="true"
android:order="1">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="https" />
<data android:scheme="http" />
<data android:host="hello-flavors.instantappsample.com" />
<data android:pathPrefix="/goodbye" />
</intent-filter>
</activity>
您还可以使用App链接辅助工具生成intent-filters。要打开它选择工具>应用程序链接助手。有关更多详细信息,请访问https://developer.android.com/studio/write/app-link-indexing.html
您需要定义至少一个default-url
作为应用程序的入口点。我在<activity>
标签中定义了它,如下所示。
<activity .....>
<meta-data
android:name="default-url"
android:value="https://www.example.com/home" />
</activity>