0

I have an instant app that deploys and runs fine to emulator or device via my local development environment. In fact, I have an old version deployed in production which works perfectly fine but hasn't been updated in a long time and much of the Instant Apps tooling has changed since that was published. This of course implies I've already setup my assetlinks file on the website correctly as well.

I'm able to upload and deploy it to my development track on Google Play without error, but when opening a handled URL, it goes to Chrome instead of the instant app. I have read the docs already. The URL is in the manifest (it works from my dev environment after all).

I've run several URLs and looked at the logs for comparison. This is an abridged version of mine (I expect it to start the instant app but it just opens on Chrome):

01-12 15:27:57.884 2887-4983/? E/JavaBinder: !!! FAILED BINDER TRANSACTION !!!  (parcel size = 1017252)
01-12 15:27:57.933 926-2361/? I/ActivityManager: START u0 {act=android.intent.action.VIEW cat=[android.intent.category.BROWSABLE] dat=https://www.example.com/... flg=0x10000000 cmp=com.android.chrome/com.google.android.apps.chrome.IntentDispatcher} from uid 10143
01-12 15:27:57.983 4985-4985/? I/cr_InstantAppsHandler: Package manager handles intents on O+, not handling in Chrome
01-12 15:27:57.985 926-2363/? I/ActivityManager: START u0 {act=android.intent.action.VIEW cat=[android.intent.category.BROWSABLE] dat=https://www.example.com/... flg=0x14002000 cmp=com.android.chrome/org.chromium.chrome.browser.ChromeTabbedActivity (has extras)} from uid 10056

vs BuzzFeed's (starts the IA successfully):

01-12 14:36:37.688 927-9531/? I/ActivityManager: START u0 {act=android.intent.action.VIEW dat=https://www.buzzfeed.com/... cmp=com.buzzfeed.android/com.buzzfeed.showxlib.activity.ShowPageInstantActivity} from uid 10166
01-12 14:36:37.814 927-2593/? I/ActivityManager: Start proc 13156:com.buzzfeed.android/u0a249 for activity com.buzzfeed.android/com.buzzfeed.showxlib.activity.ShowPageInstantActivity

vs https://www.google.com (starts Chrome as expected):

01-12 16:10:18.962 926-19253/? I/ActivityManager: START u0 {act=android.intent.action.VIEW dat=https://www.google.com/... cmp=com.android.chrome/com.google.android.apps.chrome.IntentDispatcher} from uid 10166
01-12 16:10:19.057 4985-4985/? I/cr_InstantAppsHandler: Package manager handles intents on O+, not handling in Chrome
01-12 16:10:19.060 926-3112/? I/ActivityManager: START u0 {act=android.intent.action.VIEW dat=https://www.google.com/... flg=0x14002000 cmp=com.android.chrome/org.chromium.chrome.browser.ChromeTabbedActivity (has extras)} from uid 10056

The FAILED BINDER TRANSACTION is the only thing that stands out. While it's difficult to truly attribute it to being related to resolving the IA intent, I've run this multiple times and seen the same behavior every time.

Is there a way I can get more information about what's going wrong and why it's failing to launch the instant app?

Also note that I've checked my tester lists and opted in via the URL, etc. already.

Here's a simplified form of what my intent filters look like:

<intent-filter android:autoVerify="true">
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.BROWSABLE" />
    <category android:name="android.intent.category.DEFAULT" />

    <data android:host="www.example.com" />
    <data android:scheme="https" />
    <data android:scheme="http" />

    <data android:path="/k/keyword1" />
    <data android:path="/k/keyword2" />
    <data android:path="/k/keyword3" />
    ...
    <data android:path="/k/keyword1000" />

</intent-filter>

Imagine that I don't want to match:

    <data android:path="/k/keyword1001" />
    ...
    <data android:path="/k/keyword2000" />

If I have only a few data/path elements, then it seems to work, but when I get to a large number, the instant app fails to load.

kabuko
  • 36,028
  • 10
  • 80
  • 93
  • Note that the `FAILED BINDER TRANSACTION` has a large parcel size. I'm wondering if my very large manifest is causing me to exceed the binder transaction buffer limit of 1MB. It seems strange that this works locally, but not via Play, but it could be that the device `PackageManager` runs some metadata through some `Intent` that the local tooling does not. – kabuko Jan 13 '18 at 01:27
  • can you check https://developer.android.com/topic/instant-apps/faqs.html. – Prags Jan 15 '18 at 09:27
  • and https://support.google.com/googleplay/android-developer/answer/7381861 – Prags Jan 15 '18 at 09:37
  • @PragatiSingh yes, I've read through both of those numerous times. I'm actually leaning towards my hypothesis in the comment being somewhat correct. My current manifest has a ton of URLs in an intent handler that look like `/a//b` and it seems to work if instead of explicitly listing them in `path` I use a `patternPath` with value `/a/..*/b`. This isn't a perfect solution however, as I would like to be able to only use the instant app for certain paths. – kabuko Jan 16 '18 at 19:15
  • Can you post an example of your manifest's intent filters in the way that you wish to use? – TWL Jan 19 '18 at 22:18
  • @TWL I've edited the question to include examples of what the desired intent filter would look like. – kabuko Jan 19 '18 at 23:15
  • How many is "a large number" ? I tried 10 paths packed into one intent-filter and it was working fine. – TWL Jan 22 '18 at 19:23
  • Not sure where the line is, but I had something like 1,000. – kabuko Jan 22 '18 at 19:58

1 Answers1

0

Launching an Instant App indeed requires interprocess communication from Google Play Services. (The exact kind depends on whether you're running Android Oreo.)

We're working on removing some of the overhead, but it'll take a long time to roll out. Assuming that you're observing the problem on Android N or earlier, you can work around this by using shorter activity names. For example, if you have a class called:

com.really_long_package.SearchActivity

I suggest creating an alias with a short name, e.g.

package shortn;
public class SA extends com.really_long_package.SearchActivity {}

and then refer to shortn.SA in AndroidManifest.xml.

dchai
  • 231
  • 2
  • 4
  • Thanks, in the end, I managed to get my specific scenario to work with a pathPattern instead of all the explicit paths, but it's to have confirmation that it is indeed the IPC limitation. – kabuko Jan 22 '18 at 23:36
  • Fast forward 2-3 years. I have pushed my instant app app bundle to "Internal App Shaing" on Play console (nowadays the require app bundle instead of APK), and still see this same error when I tap on an app link which should download the instant app. But cr_InstantAppsHandler returns same error. Any ideas? I do use pathPattern. – andude Oct 28 '20 at 21:26