facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
118.05k stars 24.19k forks source link

[Android] Fatal Exception: kotlin.KotlinNullPointerException in React-native App #31357

Closed tiggem1993 closed 9 months ago

tiggem1993 commented 3 years ago

I am working on React-native (v0.63.4) Android and iOS app, in which I have receive the crashFatal Exception: kotlin.KotlinNullPointerException in Firebase Crashlytics (v10.1.0) , but the kotlin is not used anywhere. Android folder having all necessary files like build.gradle, MainActivity.java & MainApplication.java all are using java. This crash was received from production version from app user.

Device Info:

Crash occurred two times:

Type Crash 1 Crash 2
Model HUAWEI P20 lite Samsung Galaxy On7 Prime
RAM free 1.51 GB 866.67 MB
Disk free 23.65 GB 15.75 GB
Android Version 9 8.0.0
Orientation Portrait Portrait
Rooted No No
Build Type arm64-v8a armeabi-v7a

Crash Logs:

Crash log captured by Firebase Crashlytics. Crash 1,

Fatal Exception: kotlin.KotlinNullPointerException
   at a.b.a.a.f.e.b.c(SourceFile:34)
   at a.b.a.a.f.e.b.a(SourceFile:14)
   at a.b.a.a.f.e.b.a(SourceFile:2)
   at a.b.a.a.f.e.b$b.a(SourceFile:7)
   at a.b.a.a.f.e.b$b.a(SourceFile:1)
   at a.b.a.a.f.a.a(SourceFile:3)
   at a.b.a.a.f.a.a(SourceFile:1)
   at a.b.a.a.f.b$c.a(SourceFile:2)
   at a.b.a.a.f.d.a$b$c.run(SourceFile:1)
   at android.os.Handler.handleCallback(Handler.java:907)
   at android.os.Handler.dispatchMessage(Handler.java:105)
   at android.os.Looper.loop(Looper.java:216)
   at android.app.ActivityThread.main(ActivityThread.java:7625)
   at java.lang.reflect.Method.invoke(Method.java)
   at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:987)

Crash 2,

Fatal Exception: kotlin.KotlinNullPointerException
   at a.b.a.a.e.i.g.b.a(SourceFile:305)
   at a.b.a.a.e.i.g.e.a.onTouch(SourceFile:1)
   at android.widget.PopupWindow$PopupDecorView.dispatchTouchEvent(PopupWindow.java:2683)
   at android.view.View.dispatchPointerEvent(View.java:12788)
   at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:5675)
   at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:5470)
   at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4963)
   at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5016)
   at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4982)
   at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:5119)
   at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4990)
   at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:5176)
   at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4963)
   at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5016)
   at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4982)
   at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4990)
   at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4963)
   at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:7742)
   at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:7682)
   at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:7643)
   at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:7853)
   at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:197)
   at android.os.MessageQueue.nativePollOnce(MessageQueue.java)
   at android.os.MessageQueue.next(MessageQueue.java:325)
   at android.os.Looper.loop(Looper.java:142)
   at android.app.ActivityThread.main(ActivityThread.java:6942)
   at java.lang.reflect.Method.invoke(Method.java)
   at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)

How to reproduce

I am keep tracking user action via Firebase events and Clevertap Events. So I follow the same action step by step in Android Simulator (Android 9 & 8) but I didn't get any kind of crash. So it is hard to reproduce in Android Simulator.

My Investigation

  1. As I came to know that nothing is wrong with my code because codebase is in JavaScript and Java. It might be happening with any third party library or dependencies. Which is directly or indirectly using Kotlin. For this I am sharing my package.json.
  2. I have found OkHttp footprints in my crash logs. See screenshots. OkHttp also made some major change from version 3.8.0 regarding Kotlin. So it might be one of reason for crash. https://square.github.io/okhttp/changelog_3x/#version-380

My Question

Are you using the Kotlin or Okhttp? If yes, then Is this crash occurred by React-Native? If Yes, I can share this crash log with full details. See screenshot.

Is it resolved if I upgrade my react-native 0.63 to 0.64? Please suggest.

package.json:

"dependencies": {
    "@react-native-async-storage/async-storage": "^1.13.2",
    "@react-native-community/clipboard": "^1.5.1",
    "@react-native-community/geolocation": "^2.0.2",
    "@react-native-community/masked-view": "^0.1.10",
    "@react-native-community/netinfo": "^5.9.9",
    "@react-native-community/toolbar-android": "^0.1.0-rc.2",
    "@react-native-firebase/analytics": "^10.1.0",
    "@react-native-firebase/app": "^10.1.0",
    "@react-native-firebase/crashlytics": "^10.1.0",
    "@react-native-firebase/perf": "^11.1.2",
    "@twotalltotems/react-native-otp-input": "^1.3.11",
    "add": "^2.0.6",
    "axios": "^0.21.0",
    "clevertap-react-native": "^0.5.0",
    "compare-versions": "^3.6.0",
    "jwt-decode": "^3.1.2",
    "passport-orcid": "^0.0.4",
    "react": "16.13.1",
    "react-content-loader": "^5.0.2",
    "react-dom": "^16.13.1",
    "react-native": "0.63.4",
    "react-native-app-intro-slider": "^3.0.0",
    "react-native-appearance": "^0.3.2",
    "react-native-charts-wrapper": "^0.5.7",
    "react-native-circular-progress": "^1.3.6",
    "react-native-config": "^1.4.1",
    "react-native-cookies": "^3.3.0",
    "react-native-datepicker": "^1.7.2",
    "react-native-device-info": "^5.5.4",
    "react-native-document-picker": "^3.3.2",
    "react-native-fbsdk": "^3.0.0",
    "react-native-gesture-handler": "^1.9.0",
    "react-native-highlight-words": "^1.0.1",
    "react-native-htmlview": "^0.15.0",
    "react-native-linkedin": "^2.1.1",
    "react-native-modal": "^11.5.6",
    "react-native-navigation": "^2.13.1",
    "react-native-pdf": "github:wonday/react-native-pdf#master",
    "react-native-popover-view": "^2.0.5",
    "react-native-reanimated": "^1.7.0",
    "react-native-safe-area-context": "^0.6.2",
    "react-native-screens": "^2.0.0-alpha.29",
    "react-native-sectioned-multi-select": "^0.7.6",
    "react-native-share": "^3.2.0",
    "react-native-slider": "^0.11.0",
    "react-native-snap-carousel": "^3.8.4",
    "react-native-splash-screen": "^3.2.0",
    "react-native-svg": "^11.0.1",
    "react-native-swipeable": "^0.6.0",
    "react-native-tab-view": "^2.13.0",
    "react-native-vector-icons": "^6.6.0",
    "react-native-webview": "^11.3.2",
    "react-navigation": "^4.0.10",
    "react-navigation-drawer": "^2.3.3",
    "react-navigation-stack": "^2.0.16",
    "react-redux": "^7.2.2",
    "redux": "^4.0.5",
    "redux-axios-middleware": "^4.0.1",
    "redux-logger": "^3.0.6",
    "redux-persist": "^6.0.0",
    "redux-persist-filesystem-storage": "^3.0.0",
    "redux-promise": "^0.6.0",
    "redux-thunk": "^2.3.0",
    "rn-fetch-blob": "^0.10.16",
    "smartlook-react-native-wrapper": "^0.39.0",
    "yarn": "^1.22.10"
},

"devDependencies": {
    "@babel/core": "^7.12.10",
    "@babel/runtime": "^7.12.5,
    "@react-native-community/eslint-config": "^2.0.0",
    "babel-jest": "^26.6.3",
    "eslint": "^7.18.0",
    "jest": "^26.6.3",
    "metro-react-native-babel-preset": "^0.64.0",
    "react-test-renderer": "16.13.1"
},

"jest": {
    "preset": "react-native"
}

full

cortinico commented 9 months ago

Hey, We're cleaning up the React Native issue tracker to make sure we focus on the most important issues first.

I'm closing this one because it's stale and related to a version of React Native we no longer support. If the issue persists on the latest version, please re-open a new issue and reference this one.

Moreover, we generally can't fix issues just by looking at a stacktrace reported from your crash reporting platform. Please provide a reproducer in your future reports.

Thank you.