Sentry-react-native: Crash on Android 4.1 with version 1.2.1

Created on 3 Jan 2020  路  6Comments  路  Source: getsentry/sentry-react-native

OS:

  • [ ] Windows
  • [x] MacOS
  • [ ] Linux

_Platform:_

  • [ ] iOS
  • [x] Android

SDK:

  • [x] @sentry/react-native
  • [ ] react-native-sentry

react-native version: 0.61.5


I have following issue:

Sentry crashes app on init on Android 4.1 with version 1.2.1, works fine on 1.2.0.

Exception in native call
java.lang.RuntimeException: Could not invoke RNSentry.startWithDsnString
    at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:382)
    at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:150)
    at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
    at android.os.Handler.handleCallback(Handler.java:615)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:26)
    at android.os.Looper.loop(Looper.java:137)
    at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:225)
    at java.lang.Thread.run(Thread.java:856)
Caused by: java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:371)
    ... 8 more
Caused by: java.lang.NoClassDefFoundError: java.util.Objects
    at io.sentry.SentryOptions.<init>(SentryOptions.java:42)
    at io.sentry.SentryOptions.from(SentryOptions.java:90)
    at io.sentry.SentryOptions.defaults(SentryOptions.java:117)
    at io.sentry.Sentry.init(Sentry.java:110)
    at io.sentry.RNSentryModule.startWithDsnString(RNSentryModule.java:92)
    ... 11 more

Steps to reproduce:

  • Call Sentry.Init()
  • Crashes

Actual result:

  • Crashes

Expected result:

  • No crash

Most helpful comment

@Mitch528 this issue has been fixed and a new version has been released right now, let's wait for @HazAT BUMP sentry-android now :)

All 6 comments

Same for me

i am running into the same issue in Android 4.3 with version 1.2.1 and 1.2.0
java.lang.RuntimeException: Could not invoke RNSentry.startWithDsnString at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:382) at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:150) at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method) at android.os.Handler.handleCallback(Handler.java:730) at android.os.Handler.dispatchMessage(Handler.java:92) at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:26) at android.os.Looper.loop(Looper.java:137) at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:225) at java.lang.Thread.run(Thread.java:841) Caused by: java.lang.reflect.InvocationTargetException at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:525) at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:371) at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:150)聽 at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)聽 at android.os.Handler.handleCallback(Handler.java:730)聽 at android.os.Handler.dispatchMessage(Handler.java:92)聽 at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:26)聽 at android.os.Looper.loop(Looper.java:137)聽 at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:225)聽 at java.lang.Thread.run(Thread.java:841)聽 Caused by: java.lang.NoClassDefFoundError: java.util.Objects at io.sentry.SentryOptions.<init>(SentryOptions.java:42) at io.sentry.SentryOptions.from(SentryOptions.java:90) at io.sentry.SentryOptions.defaults(SentryOptions.java:117) at io.sentry.Sentry.init(Sentry.java:110) at io.sentry.RNSentryModule.startWithDsnString(RNSentryModule.java:92)

Any progress in this one ?

Hey, please make sure you cleaned all your caches, node_modules and everything else you can clean xD
I just tried a clean react-native project and it worked.
If you are not using autolinking please make sure to call react-native link @sentry/react-native

Closing this now, please provide a reproduction example otherwise we can't do anything about this.

@HazAT I tried it with my own private project and it crashes when running it on Android 4.1, at least.

Also, made a completely new react-native project and included only Sentry and it behaves exactly the same way. I made a public repo with this exact project. Maybe this helps?
https://github.com/feiooos/react-native-sentry-crash-test

This is the stack trace that I get:

    java.lang.RuntimeException: Could not invoke RNSentry.startWithDsnString
        at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:383)
        at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:158)
        at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
        at android.os.Handler.handleCallback(Handler.java:730)
        at android.os.Handler.dispatchMessage(Handler.java:92)
        at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:29)
        at android.os.Looper.loop(Looper.java:213)
        at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:232)
        at java.lang.Thread.run(Thread.java:841)
     Caused by: java.lang.reflect.InvocationTargetException
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:525)
        at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372)
        at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:158)聽
        at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)聽
        at android.os.Handler.handleCallback(Handler.java:730)聽
        at android.os.Handler.dispatchMessage(Handler.java:92)聽
        at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:29)聽
        at android.os.Looper.loop(Looper.java:213)聽
        at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:232)聽
        at java.lang.Thread.run(Thread.java:841)聽
     Caused by: java.lang.NoClassDefFoundError: java.util.Objects
        at io.sentry.SentryOptions.<init>(SentryOptions.java:42)
        at io.sentry.SentryOptions.from(SentryOptions.java:90)
        at io.sentry.SentryOptions.defaults(SentryOptions.java:117)
        at io.sentry.Sentry.init(Sentry.java:110)
        at io.sentry.RNSentryModule.startWithDsnString(RNSentryModule.java:92)
        at java.lang.reflect.Method.invokeNative(Native Method)聽
        at java.lang.reflect.Method.invoke(Method.java:525)聽
        at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372)聽
        at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:158)聽
        at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)聽
        at android.os.Handler.handleCallback(Handler.java:730)聽
        at android.os.Handler.dispatchMessage(Handler.java:92)聽
        at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:29)聽
        at android.os.Looper.loop(Looper.java:213)聽
        at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:232)聽
        at java.lang.Thread.run(Thread.java:841)聽

@HazAT This issue seems to be related to getsentry/sentry-java#809

@Mitch528 this issue has been fixed and a new version has been released right now, let's wait for @HazAT BUMP sentry-android now :)

Was this page helpful?
0 / 5 - 0 ratings