Instant Apps: “You should have at least one active APK that is mapped to site 'sample.com' via a web 'intent-filter' ” when pushing to production

故事扮演 提交于 2019-12-21 23:52:52

问题


I'm getting the error message when releasing instant-app to production.

I've read this post here: You should have at least one active APK that is mapped to site 'sample.com' via a web 'intent-filter' and this is a bit more specific.

The answer in the above link states:

Upload installable APK in alpha, beta or production with same HOST web 'intent-filter'.

I uploaded an installable apk w/ the intent-filter to alpha and that the error message went away when releasing my instant-app to pre-release, but when releasing instant-app to production I'm getting the same error.

You should have at least one active APK that is mapped to site 'sample.com' via a web 'intent-filter'.

My installable apk with the default-url intent-filter was only uploaded to alpha. However, I'm wondering if my installable apk w/ intent-filter needs to be moved to production when I try to push my instant-app to production?


回答1:


The reason is because the behavior needs to be the same between the same track level of the installed and instant app. The user would experience a different URL resolving behavior if the user uses the installed-app (without the proper intent-filters) after downloading the instant app.




回答2:


You have to add the app-link to your activity. Here's one example of what it looks like.

        <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>

You can also use App link assistant tool to generate intent-filters. To open it Select Tools > App Links Assistant. For more details go to https://developer.android.com/studio/write/app-link-indexing.html




回答3:


You need to define at least one default-url as the entry point to your app. I have defined it inside <activity> tag as below.

<activity .....>
            <meta-data
                android:name="default-url"
                android:value="https://www.example.com/home" />
</activity>


来源:https://stackoverflow.com/questions/47972791/instant-apps-you-should-have-at-least-one-active-apk-that-is-mapped-to-site-s

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!