question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NullPointerException in com.google.androidbrowserhelper.trusted.TwaLauncher.launchWhenSplashScreenReady

See original GitHub issue

Describe the bug We have recently upgraded from the google custom tabs client to android browser helper and notice a significant number of crashes, the highest being related to a NullPointerException from com.google.androidbrowserhelper.trusted.TwaLauncher.launchWhenSplashScreenReady

To Reproduce Steps to reproduce the behavior:

  1. Download Badoo Lite from play store using one of the mentioned devices in screenshot.
  2. Launch the app

Errors are recorded when the app launches, play console has this stack trace from a Motorola Moto C Plus, but see also attached affected devices):

java.lang.NullPointerException: 
  at androidx.browser.trusted.TrustedWebActivityIntentBuilder.build (TrustedWebActivityIntentBuilder.java:220)
  at com.google.androidbrowserhelper.trusted.TwaLauncher.launchWhenSplashScreenReady (TwaLauncher.java:229)
  at com.google.androidbrowserhelper.trusted.TwaLauncher.lambda$launchWhenSessionEstablished$3$TwaLauncher (TwaLauncher.java:217)
  at com.google.androidbrowserhelper.trusted.-$$Lambda$TwaLauncher$Pgq1RErTrlHE2hqdSd7zUQR6Yz4.run (lambda)
  at com.google.androidbrowserhelper.trusted.splashscreens.PwaWrapperSplashScreenStrategy.onSplashImageTransferred (PwaWrapperSplashScreenStrategy.java:202)
  at com.google.androidbrowserhelper.trusted.splashscreens.PwaWrapperSplashScreenStrategy.lambda$configureTwaBuilder$0$PwaWrapperSplashScreenStrategy (PwaWrapperSplashScreenStrategy.java:195)
  at com.google.androidbrowserhelper.trusted.splashscreens.-$$Lambda$PwaWrapperSplashScreenStrategy$w9o5iqMEy62ZZ2i_sMAmRiQ7IGw.onFinished (lambda)
  at com.google.androidbrowserhelper.trusted.splashscreens.SplashImageTransferTask$1.onPostExecute (SplashImageTransferTask.java:144)
  at com.google.androidbrowserhelper.trusted.splashscreens.SplashImageTransferTask$1.onPostExecute (SplashImageTransferTask.java:91)
  at android.os.AsyncTask.finish (AsyncTask.java:660)
  at android.os.AsyncTask.-wrap1 (AsyncTask.java)
  at android.os.AsyncTask$InternalHandler.handleMessage (AsyncTask.java:677)
  at android.os.Handler.dispatchMessage (Handler.java:110)
  at android.os.Looper.loop (Looper.java:203)
  at android.app.ActivityThread.main (ActivityThread.java:6251)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1075)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:936)

Expected behavior App launches without the NullPointerException

Did this ever used to work Similar error happened with google tabs client.

Screenshots Screenshot 2020-06-08 at 12 56 24 Screenshot 2020-06-08 at 13 04 36

Code Snippets Splash screen strategy is being set with this code:

this.mSplashScreenStrategy = new PwaWrapperSplashScreenStrategy(this, this.mMetadata.splashImageDrawableId, this.getColorCompat(this.mMetadata.splashScreenBackgroundColorId), this.getSplashImageScaleType(), this.getSplashImageTransformationMatrix(), this.mMetadata.splashScreenFadeOutDurationMillis, this.mMetadata.fileProviderAuthority);

These all have values except for transformation matrix which is null.

Smartphone (please complete the following information):

  • Device: Motorola Moto C Plus
  • OS: Android 8.1
  • Browsers Installed: Chrome
  • Browser Versions: Don’t know
  • android-browser-helper library version: 1.1.0

Additional context Badoo Lite is released on the play store for low end devices as an alternative for the native android app.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:41 (19 by maintainers)

github_iconTop GitHub Comments

2reactions
andrebancommented, Jun 26, 2020

We have released 1.4.0-alpha01 yesterday with the fix for this issue included:

    implementation 'com.google.androidbrowserhelper:androidbrowserhelper:1.4.0-alpha01'
1reaction
andrebancommented, Dec 7, 2020

androidx.browser-1.3.0 has finally hit stable and we have released version 2.1.0 of android-browser-helper, which depends on the new androidx.browser version. This bug shouldn’t happen anymore when using that. To use it, update the app’s build.gradle as below:

implementation 'com.google.androidbrowserhelper:androidbrowserhelper:2.1.0'

Thanks for the patience for this issue to be resolved.

Read more comments on GitHub >

github_iconTop Results From Across the Web

NullPointerException when using Trusted Web Activities on ...
I'm using TrustedWebActivities and I'm getting an immediate app crash on Samsung S8, S9, and Pixel 2 devices with the below Exception. Some ......
Read more >
How to Fix and Avoid NullPointerException in Java - Rollbar
NullPointerException in Java occurs when a variable is accessed which is not pointing to any object and refers to nothing or null.
Read more >
Java NullPointerException - Detect, Fix, and Best Practices
Anybody working in java must have seen this popping out of nowhere in the java standalone program as well as the java web...
Read more >
NullPointerException - Android Developers
NullPointerException objects may be constructed by the virtual machine as if stack ... Google uses cookies to deliver its services, to personalize ads, ......
Read more >
How to resolve the java.lang.NullPointerException - Educative.io
In some cases, the compiler prevents this exception with the compile-time error “The variable might not have been initialized” when a null reference...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found