android-customtabs
android-customtabs copied to clipboard
WebView Activity NullPointerException on loadUrl()
This is from Firebase Crashlytics:
Caused by java.lang.NullPointerException: Attempt to invoke virtual method 'void android.webkit.WebView.loadUrl(java.lang.String)' on a null object reference at saschpe.android.customtabs.WebViewActivity.onCreate() at android.app.Activity.performCreate(Activity.java:6876) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1135) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3206) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3349) at android.app.ActivityThread.access$1100(ActivityThread.java:221) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:158) at android.app.ActivityThread.main(ActivityThread.java:7225) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
It's happened multiple times across different devices like and mostly Xiaomi(~33%). 70% of crashes occurred on Android 9.
And it's All written codes to interact with customTab:
val customTabsIntent: CustomTabsIntent? = CustomTabsIntent.Builder()
.setToolbarColor(ContextCompat.getColor(context, R.color.colorPrimary))
.setShowTitle(true)
.build()
CustomTabsHelper.addKeepAliveExtra(context, customTabsIntent!!.intent)
CustomTabsHelper.openCustomTab(
context, customTabsIntent,
Uri.parse(uri),
WebViewFallback()
)