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.

Crash caused by RNCWebViewManager.java line 710 (java.lang.NullPointerException)

See original GitHub issue

Bug description: Crashlytics shows regular Android crashes caused by:

Attempt to invoke virtual method 'int android.app.Activity.getRequestedOrientation()' on a null object reference

com.reactnativecommunity.webview.RNCWebViewManager.setupWebChromeClient (RNCWebViewManager.java:710)
com.reactnativecommunity.webview.RNCWebViewManager.setAllowsFullscreenVideo (RNCWebViewManager.java:574)
java.lang.reflect.Method.invoke (Method.java)
com.facebook.react.uimanager.ViewManagersPropertyCache$PropSetter.updateViewProp (ViewManagersPropertyCache.java:87)
com.facebook.react.uimanager.ViewManagerPropertyUpdater$FallbackViewManagerSetter.setProperty (ViewManagerPropertyUpdater.java:136)
com.facebook.react.uimanager.ViewManagerPropertyUpdater.updateProps (ViewManagerPropertyUpdater.java:56)
com.facebook.react.uimanager.ViewManager.updateProperties (ViewManager.java:49)
com.facebook.react.uimanager.NativeViewHierarchyManager.createView (NativeViewHierarchyManager.java:270)
com.facebook.react.uimanager.UIViewOperationQueue$CreateViewOperation.execute (UIViewOperationQueue.java:186)
com.facebook.react.uimanager.UIViewOperationQueue$1.run (UIViewOperationQueue.java:911)
com.facebook.react.uimanager.UIViewOperationQueue.flushPendingBatches (UIViewOperationQueue.java:1028)
com.facebook.react.uimanager.UIViewOperationQueue.access$2600 (UIViewOperationQueue.java:48)
com.facebook.react.uimanager.UIViewOperationQueue$2.runGuarded (UIViewOperationQueue.java:986)
com.facebook.react.bridge.GuardedRunnable.run (GuardedRunnable.java:31)

To Reproduce:

Cannot reproduce it myself but firebase Crashlytics show regular crashes for active users.

Expected behavior: Not Crash

Screenshots/Videos:

Screenshot 2021-10-07 at 14 25 04

Environment:

  • OS: Android
  • OS version: Android 11
  • react-native version: ^0.63.4
  • react-native-webview version: ^11.2.0

Related: https://github.com/react-native-webview/react-native-webview/pull/2025

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
ds8kcommented, Oct 15, 2021
protected void setupWebChromeClient(ReactContext reactContext, WebView webView) {
    if (reactContext == null || reactContext.getCurrentActivity() == null) {
      Log.e("RNCWebViewManager setupWebChromeClient()", "Cannot call reactContext.getCurrentActivity()");
      return;
    }
    ...
 }

In addition to this, you have to import android.util.log in order to run the above log, otherwise your app won’t build.

0reactions
react-native-community-botcommented, Nov 26, 2021

🎉 This issue has been resolved in version 11.14.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

Read more comments on GitHub >

github_iconTop Results From Across the Web

react native webview java.lang.NullPointerException
Many times to open the WebView, resulting in a number of WebView, it is estimated that the memory leak, I would like to...
Read more >
How to Fix and Avoid NullPointerException in Java - Rollbar
The NullPointerException occurs due to a situation in application code where an uninitialized object is attempted to be accessed or modified.
Read more >
A Linux Java client crashes on startup with URE & NPE ... - IBM
Attempts to start a Java/Developer client on Linux crashes with error "Unhandled runtime exception: java.lang.NullPointerException" (URE) ...
Read more >
How to resolve the java.lang.NullPointerException - Educative.io
In Java, the java.lang.NullPointerException is thrown when a reference variable is accessed (or de-referenced) and is not pointing to any object.
Read more >
Java NullPointerException - Detect, Fix, and Best Practices
NullPointerException. java lang nullpointerexception hierarchy. NullPointerException is a runtime exception, so we don't need to catch it in the ...
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