GithubHelp home page GithubHelp logo

Comments (25)

andreban avatar andreban commented on May 19, 2024 2

Also started to get this same error on the 16th April, and it is still ongoing:

image

This error seems similar to one when we first created our TWA, but google released an updated custom tabs version to rectify the error. So to be explicit, our implementation is set to:

implementation 'com.github.GoogleChrome:custom-tabs-client:809a55cfa2'

@dazbradbury a bit unrelated to this issue, but the recommended way of using Trusted Web Activity is via android-browser-helper currently: https://developers.google.com/web/android/trusted-web-activity/android-browser-helper-migration

from android-browser-helper.

andreban avatar andreban commented on May 19, 2024 2

I have prepared a package (1.3.1-alpha01) today. The plan is to make it available to use tomorrow via the Google Maven. I'll update the the issue once available. When we have some apps using it and we can confirm the issue is indeed fixed, we'll release 1.3.1.

from android-browser-helper.

andreban avatar andreban commented on May 19, 2024 1

For this particular error, unlikely - But there are other issues fixed in the new library, and many other features.

This comment #89 (comment) describes what I could understand from the issue - It's about PackageManager returning an app that doesn't actually handle the URL we're trying to launch. So, when we actually try to launch we get an ActvityNotFoundException. The logic for picking the provider is here.

In the case of TrustedWebActivity, we know the URL that's going to be launched beforehand. I'm wondering if it's worth running the PackageManager against startUrl - This may return the app itself as a handler, but we know the package and can ignore it.

@PEConn, thoughts?

from android-browser-helper.

dazbradbury avatar dazbradbury commented on May 19, 2024 1

I'm afraid it doesn't seem the google play console provides that information (unless I'm missing something?). There is a second similar exception though that is logged as a second "crash cluster":

image

But I'm not sure if that's helpful at all, and think this is simply due to a different Android version.

from android-browser-helper.

andreban avatar andreban commented on May 19, 2024 1

#104 should fix this

from android-browser-helper.

AlexBorsody avatar AlexBorsody commented on May 19, 2024 1

Can confirm after the update I stopped seeing this error.

from android-browser-helper.

andreban avatar andreban commented on May 19, 2024

The library retrieves a list of browsers from PackageManager to check applications that can handle the following Intent:

Intent queryBrowsersIntent = new Intent()
        .setAction(Intent.ACTION_VIEW)
        .addCategory(Intent.CATEGORY_BROWSABLE)
        .setData(Uri.parse("http://"));

It seems com.revolut.revolut is returned by the PackageManager (unexpected), but doesn't handle https://travelfeed.io/?utm_source=pwa (expected). I'll take a look at how com.revolut.revolut is configured to understand why it's being returned by the PackageManager.

@PEConn FYI

from android-browser-helper.

andreban avatar andreban commented on May 19, 2024

I reproduced this by uninstalling / disabling all browsers on the device, installing Revolut and opening a Trusted Web Activity. I get the same stacktrace on logcat.

Running

adb shell query-activities -a android.intent.action.VIEW -c android.intent.category.BROWSABLE -d http:// 

outputs:

1 activities found:
  Activity #0:
    priority=0 preferredOrder=0 match=0x308000 specificIndex=-1 isDefault=true
    ActivityInfo:
      name=com.revolut.ui.deeplink.ExternalDeeplinkRoutingActivity
      packageName=com.revolut.revolut
      enabled=true exported=true directBootAware=false
      taskAffinity=com.revolut.revolut targetActivity=null persistableMode=PERSIST_ROOT_ONLY
      launchMode=3 flags=0x300200 privateFlags=0x0 theme=0x0
      screenOrientation=1 configChanges=0x3 softInputMode=0x0
      lockTaskLaunchMode=LOCK_TASK_LAUNCH_MODE_DEFAULT
      resizeMode=RESIZE_MODE_UNRESIZEABLE
      ApplicationInfo:
        name=com.revolut.RevolutApplication
        packageName=com.revolut.revolut
        labelRes=0x7f120173 nonLocalizedLabel=null icon=0x7f0f0000 banner=0x0
        className=com.revolut.RevolutApplication
        processName=com.revolut.revolut
        taskAffinity=com.revolut.revolut
        uid=10428 flags=0x20983e44 privateFlags=0x2c000910 theme=0x7f130010
        requiresSmallestWidthDp=0 compatibleWidthLimitDp=0 largestWidthLimitDp=0
        sourceDir=/data/app/com.revolut.revolut-7N-EPJjTnQuxe9Ki1Iov0g==/base.apk
        splitSourceDirs=[/data/app/com.revolut.revolut-7N-EPJjTnQuxe9Ki1Iov0g==/split_config.arm64_v8a.apk, /data/app/com.revolut.revolut-7N-EPJjTnQuxe9Ki1Iov0g==/split_config.en.apk, /data/app/com.revolut.revolut-7N-EPJjTnQuxe9Ki1Iov0g==/split_config.pt.apk, /data/app/com.revolut.revolut-7N-EPJjTnQuxe9Ki1Iov0g==/split_config.xxxhdpi.apk]
        resourceDirs=[/product/overlay/NavigationBarMode2Button/NavigationBarMode2ButtonOverlay.apk]
        seinfo=default:targetSdkVersion=29
        seinfoUser=:complete
        dataDir=/data/user/0/com.revolut.revolut
        deviceProtectedDataDir=/data/user_de/0/com.revolut.revolut
        credentialProtectedDataDir=/data/user/0/com.revolut.revolut
        splitClassLoaderNames=[null, null, null, null]
        enabled=true minSdkVersion=21 targetSdkVersion=29 versionCode=603701241 targetSandboxVersion=1
        supportsRtl=false
        fullBackupContent=true
        networkSecurityConfigRes=0x7f150004
        HiddenApiEnforcementPolicy=2
        usesNonSdkApi=false
        allowsPlaybackCapture=true

The intent-filter that seems to be matching the query in Revolut's APK is the following:

<intent-filter>
        <action
                android:name="android.intent.action.VIEW" />

        <category
                android:name="android.intent.category.DEFAULT" />

        <category
                android:name="android.intent.category.BROWSABLE" />

        <data
                android:scheme="http"
                android:host="@string/0x2f" />

         <data
                android:scheme="https"
                android:host="@string/0x2f" />

        <data
                android:scheme="http"
                android:host="@string/0x2f" />

        <data
                android:scheme="https"
                android:host="@string/0x2f" />
</intent-filter>

I'm not sure what @string/0x2f matches in their APK yet.

CC @PEConn

from android-browser-helper.

AlexBorsody avatar AlexBorsody commented on May 19, 2024

I am seeing a similar issue using the TWA repository to submit my app to the Play Store. It only happens to a small percent of our users I can tell from the crash report as our app is live. There really isn't much custom here I used the TWA repo to wrap my website that's it.


java.lang.RuntimeException: 
  at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:3555)
  at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:3707)
  at android.app.servertransaction.LaunchActivityItem.execute (LaunchActivityItem.java:83)
  at android.app.servertransaction.TransactionExecutor.executeCallbacks (TransactionExecutor.java:135)
  at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:95)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2220)
  at android.os.Handler.dispatchMessage (Handler.java:107)
  at android.os.Looper.loop (Looper.java:237)
  at android.app.ActivityThread.main (ActivityThread.java:8016)
  at java.lang.reflect.Method.invoke (Method.java)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:493)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1076)
Caused by: android.content.ActivityNotFoundException: 
  at android.app.Instrumentation.checkStartActivityResult (Instrumentation.java:2071)
  at android.app.Instrumentation.execStartActivity (Instrumentation.java:1717)
  at android.app.Activity.startActivityForResult (Activity.java:5252)
  at androidx.fragment.app.FragmentActivity.startActivityForResult (FragmentActivity.java:10)
  at android.app.Activity.startActivityForResult (Activity.java:5203)
  at androidx.fragment.app.FragmentActivity.startActivityForResult (FragmentActivity.java:10)
  at android.app.Activity.startActivity (Activity.java:5581)
  at androidx.core.content.ContextCompat.a (ContextCompat.java:6)
  at androidx.browser.customtabs.CustomTabsIntent.a (CustomTabsIntent.java:9)
  at com.google.androidbrowserhelper.trusted.TwaLauncher.a (TwaLauncher.java:15)
  at com.google.androidbrowserhelper.trusted.TwaLauncher.lambda$DcoyqNl3MYmlYZ4RwM3iIQA9ag4 (TwaLauncher.java)
  at com.google.androidbrowserhelper.trusted.-$$Lambda$e$DcoyqNl3MYmlYZ4RwM3iIQA9ag4.launch (Unknown Source)
  at com.google.androidbrowserhelper.trusted.TwaLauncher.a (TwaLauncher.java:16)
  at com.google.androidbrowserhelper.trusted.LauncherActivity.onCreate (LauncherActivity.java:185)
  at android.app.Activity.performCreate (Activity.java:7957)
  at android.app.Activity.performCreate (Activity.java:7946)
  at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1307)
  at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:3530)
  at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:3707)
  at android.app.servertransaction.LaunchActivityItem.execute (LaunchActivityItem.java:83)
  at android.app.servertransaction.TransactionExecutor.executeCallbacks (TransactionExecutor.java:135)
  at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:95)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2220)
  at android.os.Handler.dispatchMessage (Handler.java:107)
  at android.os.Looper.loop (Looper.java:237)
  at android.app.ActivityThread.main (ActivityThread.java:8016)
  at java.lang.reflect.Method.invoke (Method.java)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:493)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1076)

from android-browser-helper.

AlexBorsody avatar AlexBorsody commented on May 19, 2024

The issue started showing up in the crash logs April 19th even though nothing was updated on our side. Thanks so much for your help.

from android-browser-helper.

dazbradbury avatar dazbradbury commented on May 19, 2024

Also started to get this same error on the 16th April, and it is still ongoing:

image

This error seems similar to one when we first created our TWA, but google released an updated custom tabs version to rectify the error. So to be explicit, our implementation is set to:

implementation 'com.github.GoogleChrome:custom-tabs-client:809a55cfa2'

from android-browser-helper.

dazbradbury avatar dazbradbury commented on May 19, 2024

@andreban Thanks - happy to update now. Would I be able to tell users this will fix the issue we're seeing, or is this issue present in both the latest and old versions of how the TWA libraries are accessed?

from android-browser-helper.

AlexBorsody avatar AlexBorsody commented on May 19, 2024

Sounds like it's unrelated from the way he phrased it. But please update us if it by any chance fixes the issue.

from android-browser-helper.

dazbradbury avatar dazbradbury commented on May 19, 2024

Just to confirm - having updated the app, we're still seeing exceptions on the latest version:

`java.lang.RuntimeException` --> `Caused by: android.content.ActivityNotFoundException: `

java.lang.RuntimeException: 
  at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:3447)
  at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:3594)
  at android.app.servertransaction.LaunchActivityItem.execute (LaunchActivityItem.java:83)
  at android.app.servertransaction.TransactionExecutor.executeCallbacks (TransactionExecutor.java:135)
  at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:95)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2146)
  at android.os.Handler.dispatchMessage (Handler.java:107)
  at android.os.Looper.loop (Looper.java:237)
  at android.app.ActivityThread.main (ActivityThread.java:7777)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:493)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1047)
Caused by: android.content.ActivityNotFoundException: 
  at android.app.Instrumentation.checkStartActivityResult (Instrumentation.java:2071)
  at android.app.Instrumentation.execStartActivity (Instrumentation.java:1717)
  at android.app.Activity.startActivityForResult (Activity.java:5276)
  at androidx.fragment.app.FragmentActivity.startActivityForResult (FragmentActivity.java:767)
  at android.app.Activity.startActivityForResult (Activity.java:5234)
  at androidx.fragment.app.FragmentActivity.startActivityForResult (FragmentActivity.java:754)
  at android.app.Activity.startActivity (Activity.java:5605)
  at androidx.core.content.ContextCompat.startActivity (ContextCompat.java:251)
  at androidx.browser.customtabs.CustomTabsIntent.launchUrl (CustomTabsIntent.java:331)
  at com.google.androidbrowserhelper.trusted.TwaLauncher.lambda$static$0 (TwaLauncher.java:51)
  at com.google.androidbrowserhelper.trusted.-$$Lambda$TwaLauncher$yiLzsm37NbSon1-dZ2dCvDJv8wU.launch (Unknown Source)
  at com.google.androidbrowserhelper.trusted.TwaLauncher.launch (TwaLauncher.java:166)
  at com.google.androidbrowserhelper.trusted.LauncherActivity.onCreate (LauncherActivity.java:158)
  at android.app.Activity.performCreate (Activity.java:7981)
  at android.app.Activity.performCreate (Activity.java:7970)
  at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1307)
  at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:3422)

Seems to be effecting new devices. Let me know if I can provide any more insight / examples, otherwise thanks for the work and look forward to a fix!

from android-browser-helper.

andreban avatar andreban commented on May 19, 2024

Can you reproduce on a dev device? I'd be interested to know if there's another app other than com.revolut.revolut causing the issue.

from android-browser-helper.

dazbradbury avatar dazbradbury commented on May 19, 2024

I've not been able to reproduce. I can see that we've had 322 reports in the last 7 days (not huge, but not insignificant).

image

Error is:

image

If I simply install Revolut on a device, and try opening a TWA, I don't get the issue. I'm not sure if having a Revolut account would make a difference, but if it does, I only tested with the app installed (no account logged into).

from android-browser-helper.

andreban avatar andreban commented on May 19, 2024

Can you check if any of those exceptions include information on the Intent?

eg:

Caused by: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=https://travelfeed.io/... pkg=com.revolut.revolut (has extras) }

from android-browser-helper.

PEConn avatar PEConn commented on May 19, 2024

In response to this comment, what we probably want to do is look for the intersection of the two groups.

If we just look for apps that can handle "https://", apparently from this bug we get some apps that pretend to be browsers but aren't. If we just look for apps that can handle the start url, we'll get the TWA app and any other native apps for that site (eg, say your website also has a native app, it will trigger that).

So we should look for apps that can handle "https://" and the start url.

from android-browser-helper.

andreban avatar andreban commented on May 19, 2024

A couple other options:

  1. providerPicker to not send a package when the result is BROWSER: https://github.com/GoogleChrome/android-browser-helper/blob/master/androidbrowserhelper/src/main/java/com/google/androidbrowserhelper/trusted/TwaProviderPicker.java#L170-L171
  2. or do a similar thing in the TwaLauncher: https://github.com/GoogleChrome/android-browser-helper/blob/master/androidbrowserhelper/src/main/java/com/google/androidbrowserhelper/trusted/TwaLauncher.java#L165-L169

The upside is that we wouldn't need another call to packageManager. The downside is that we might the the disambiguation dialog when both CCTs and TWAs are not available.

from android-browser-helper.

dazbradbury avatar dazbradbury commented on May 19, 2024

Awesome - just to clarify for myself (and potentially others reading), what's the release process in terms of getting this fix from being merged to our actual users?

from android-browser-helper.

andreban avatar andreban commented on May 19, 2024

We have released version 1.3.1-alpha01 with the fix:

 implementation 'com.google.androidbrowserhelper:androidbrowserhelper:1.3.1-alpha01'

The problem seems to be that some apps advertise to handle http:// Intents, but for other URLs, so we detected them as browsers and used them as a fallback when a browser that supports Custom Tabs and Trusted Web Activity weren't available.

Here's how to reproduce the issue with version 1.3.0:

1. Disable Chrome from the settings
2. Uninstall any other browser
3. Install Revolut
4. Install DuckduckGo or any browser that doesn't support custom tabs or twas
5. start the app

Expected result:
We'd expect the URL to open in DuckDuckGo,

Actual result
It tries to open Revolut and crashes.

This is not reproducible anymore with 1.3.1-alpha01.

One interesting point is that given we fallback to Custom Tabs first, I'd expect this to be happening to a small number of users.

Besides the crashes, have you seen any user reports from reviews, etc? It'd be interesting if you are able to reach out to those users and understand which browser / versions combination they are using.

from android-browser-helper.

dazbradbury avatar dazbradbury commented on May 19, 2024

Besides the crashes, have you seen any user reports from reviews, etc? It'd be interesting if you are able to reach out to those users and understand which browser / versions combination they are using.

I will ask users if they're willing to help with this - but yes, we've had a number of reviews reporting crashes and this is the only error in the Play Console, so have to assume is the cause.

If users do respond, will ask them what browsers (and versions) they have installed. Would you like to know if they use Revolut / other apps explicitly?

from android-browser-helper.

andreban avatar andreban commented on May 19, 2024

@dazbradbury thanks for this.

My guess is that users won't really know which application is causing the error. Asking if they have Revolut installed may help, but I don't think they'll be able to identify other apps, as the error is only seen in the device logs. If they do know which apps, that would be great information.

from android-browser-helper.

andreban avatar andreban commented on May 19, 2024

I head some confirmations that this indeed fixed the issue. Please, re-open if someone still sees it after updating to 1.3.1-alpha01.

from android-browser-helper.

andreban avatar andreban commented on May 19, 2024

1.3.1 stable has released.

from android-browser-helper.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.