java.lang.RuntimeException in react native app - android

This is a stack trace from crashlytics in my react native app, it happens quite often and is the top crash by volume by far.
I'm not really sure where to begin investigating this? Does anyone have any ideas?
This happens on Android, using react native 0.55
Fatal Exception: java.lang.RuntimeException: Error invoking callback 520
at com.facebook.react.bridge.queue.NativeRunnable.run(NativeRunnable.java)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:29)
at android.os.Looper.loop(Looper.java:145)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:192)
at java.lang.Thread.run(Thread.java:818)
Caused by com.facebook.jni.CppException: Failed to create Value from JSON:
at com.facebook.react.bridge.queue.NativeRunnable.run(NativeRunnable.java)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:29)
at android.os.Looper.loop(Looper.java:145)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:192)
at java.lang.Thread.run(Thread.java:818)

Using fetch() and then doing response.json() when the server sends
malformed JSON causes a crash.Use axios as web client to call api.
If you are using react-native-fetch-blob and react-native-cached-image then also this error occur as fetch-blob using fecth() method.

Related

Android - Method addObserver must be called on the main thread

I got this error trying to setup Revenue Cat Purchases 3.4.3 on React Native.
RN 0.67
2022-02-28 07:58:39.154 5945-8093/com.farms E/unknown:ReactNative: Exception in native call
java.lang.IllegalStateException: Method addObserver must be called on the main thread
at androidx.lifecycle.LifecycleRegistry.enforceMainThreadIfNeeded(LifecycleRegistry.java:317)
at androidx.lifecycle.LifecycleRegistry.addObserver(LifecycleRegistry.java:172)
at com.revenuecat.purchases.Purchases.(Purchases.kt:160)
at com.revenuecat.purchases.Purchases$Companion.configure(Purchases.kt:1593)
at com.revenuecat.purchases.Purchases$Companion.configure$default(Purchases.kt:1560)
at com.revenuecat.purchases.common.CommonKt.configure(common.kt:271)
at com.revenuecat.purchases.react.RNPurchasesModule.setupPurchases(RNPurchasesModule.java:73)
at java.lang.reflect.Method.invoke(Native Method)
at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372)
at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:188)
at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)
at android.os.Looper.loop(Looper.java:237)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:226)
at java.lang.Thread.run(Thread.java:919)
Anyone faced it? Thanks!
EDIT:
Ok! Updating to react-native-purchases 4.5.2 solves the problem!

getting crash in react native app for android

in our react native app we have used firebase, and location services .
here we are getting crash in react native and its very difficult to understand and reproduce it.
here is the crash.
Fatal Exception: java.lang.IllegalMonitorStateException
at java.util.concurrent.locks.ReentrantLock$Sync.tryRelease(ReentrantLock.java:152)
at java.util.concurrent.locks.AbstractQueuedSynchronizer.release(AbstractQueuedSynchronizer.java:1285)
at java.util.concurrent.locks.ReentrantLock.unlock(ReentrantLock.java:458)
at io.invertase.firebase.firestore.RNFirebaseFirestoreTransactionHandler.safeUnlock(RNFirebaseFirestoreTransactionHandler.java:160)
at io.invertase.firebase.firestore.RNFirebaseFirestoreTransactionHandler.abort(RNFirebaseFirestoreTransactionHandler.java:50)
at io.invertase.firebase.firestore.RNFirebaseFirestore.transactionDispose(RNFirebaseFirestore.java:281)
at java.lang.reflect.Method.invoke(Method.java)
at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372)
at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:160)
at com.facebook.react.bridge.queue.NativeRunnable.run(NativeRunnable.java)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:29)
at android.os.Looper.loop(Looper.java:164)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:192)
at java.lang.Thread.run(Thread.java:764)
how to check the cause of this crash in react native ?

DeadObjectException with stacktrace pointing to : android.app.ApplicationPackageManager.getPackageInstaller

I'm seeing in crash being reported in crashlytics which has this stack trace which has no mention of my app code.
I have seen DeadObjectException with com.google.android.gms and there, the crash was triggered when removing listeners.
Also, everytime my app starts, I get the installer for logging purposes, i.e.
packageManager.getInstallerPackageName(my-package-name)
There is no callback associated with this call.
Crash is observed mainly on Lollipop and Kitkat, though few Marshmallow and Nougat users have experienced it too.
Has anyone experienced something similar?
Fatal Exception: java.lang.RuntimeException: android.os.DeadObjectException
at android.app.ApplicationPackageManager.getPackageInstaller(ApplicationPackageManager.java:1632)
at com.google.android.gms.common.zze.zzl(Unknown Source)
at com.google.android.gms.common.GoogleApiAvailability.getInstance(Unknown Source:8000)
at com.google.android.gms.internal.zzpy.zzc(Unknown Source:24000)
at com.google.android.gms.internal.zzpv.begin(Unknown Source)
at com.google.android.gms.internal.zzqa.zzc(Unknown Source)
at com.google.android.gms.internal.zzpp.onConnectionSuspended(Unknown Source)
at com.google.android.gms.common.internal.zzk$1.onConnectionSuspended(Unknown Source)
at com.google.android.gms.common.internal.zzd$zzd.handleMessage(Unknown Source)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5438)
at java.lang.reflect.Method.invoke(Method.java)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:699)
Caused by android.os.DeadObjectException
at android.os.BinderProxy.transactNative(Binder.java)
at android.os.BinderProxy.transact(Binder.java:496)
at android.content.pm.IPackageManager$Stub$Proxy.getPackageInstaller(IPackageManager.java:4229)
at android.app.ApplicationPackageManager.getPackageInstaller(ApplicationPackageManager.java:1629)
at com.google.android.gms.common.zze.zzl(Unknown Source)
at com.google.android.gms.common.GoogleApiAvailability.getInstance(Unknown Source:8000)
at com.google.android.gms.internal.zzpy.zzc(Unknown Source:24000)
at com.google.android.gms.internal.zzpv.begin(Unknown Source)
at com.google.android.gms.internal.zzqa.zzc(Unknown Source)
at com.google.android.gms.internal.zzpp.onConnectionSuspended(Unknown Source)
at com.google.android.gms.common.internal.zzk$1.onConnectionSuspended(Unknown Source)
at com.google.android.gms.common.internal.zzd$zzd.handleMessage(Unknown Source)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5438)
at java.lang.reflect.Method.invoke(Method.java)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:699)
Here are the Fabric crashlytics reason for this exception.
DeadObjectExceptions are usually a symptom of a problem occurring somewhere else (likely in a remote process). Even though this exception may be safe to catch, it's worth looking for problems in related services.
This error could mean one of two things:
1) There is a bug (which caused a crash) in an associated process.
2) The other process was killed by the OS.
Source: Fabric crashlytics report.
Resources: Here & Here

react native with firebase storage getDownloadUrl() error in android

I'm using react native in Android and I'm hoping to download files from Firebase Storage.
But I'm getting this error when I use firebase storage .getDownloadUrl() method
(NB: The database works just fine)
Could not close WebSocket connection for id 0
java.net.SocketException: Socket is closed
at com.android.org.conscrypt.OpenSSLSocketImpl.checkOpen(OpenSSLSocketImpl.java:247)
at com.android.org.conscrypt.OpenSSLSocketImpl.-wrap0(OpenSSLSocketImpl.java)
at com.android.org.conscrypt.OpenSSLSocketImpl$SSLOutputStream.write(OpenSSLSocketImpl.java:756)
at okio.Okio$1.write(Okio.java:80)
at okio.AsyncTimeout$1.write(AsyncTimeout.java:155)
at okio.RealBufferedSink.flush(RealBufferedSink.java:221)
at com.squareup.okhttp.internal.ws.WebSocketWriter.writeControlFrame(WebSocketWriter.java:151)
at com.squareup.okhttp.internal.ws.WebSocketWriter.writeClose(WebSocketWriter.java:112)
at com.squareup.okhttp.internal.ws.RealWebSocket.close(RealWebSocket.java:135)
at com.facebook.react.modules.websocket.WebSocketModule.close(WebSocketModule.java:186)
at java.lang.reflect.Method.invoke(Native Method)
at com.facebook.react.bridge.BaseJavaModule$JavaMethod.invoke(BaseJavaModule.java:343)
at com.facebook.react.bridge.NativeModuleRegistry$ModuleDefinition.call(NativeModuleRegistry.java:187)
at com.facebook.react.bridge.NativeModuleRegistry.call(NativeModuleRegistry.java:62)
at com.facebook.react.bridge.CatalystInstanceImpl$NativeModulesReactCallback.call(CatalystInstanceImpl.java:432)
at com.facebook.react.bridge.queue.NativeRunnableDeprecated.run(Native
Method)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31)
at android.os.Looper.loop(Looper.java:148)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:187)
at java.lang.Thread.run(Thread.java:818)
version:
react-native: 0.25.1
I don't get this error in my IOS emulator
Any help would be appreciated,

MonkeyTalk Causing VerifyException in Android Activity

I'm trying to integrate MonkeyTalk automation into my pre-existing Android app that is built using gradle.
I followed the steps here: Android Studio and MonkeyTalk? and got the demo app working, but when I run it in my own application I get the following crash on the second screen. Any idea why this happens?
This particular stack trace is using L preview targeting SDK 19, but I've also seen a similar (less detailed) stack trace on a Galaxy S4 with SDK 18 on it.
07-21 15:35:18.394 14642-14642/com.example.android.debug E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.example.android.debug, PID: 14642
java.lang.VerifyError: Rejecting class com.example.android.activity.main.MainActivity because it failed compile-time verification (declaration of 'com.example.android.activity.main.MainActivity' appears in /data/app/com.example.android.debug-1.apk)
at java.lang.reflect.Constructor.newInstance(Native Method)
at java.lang.Class.newInstance(Class.java:1572)
at android.app.Instrumentation.newActivity(Instrumentation.java:1062)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2157)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2317)
at android.app.ActivityThread.access$800(ActivityThread.java:143)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1258)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5070)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:836)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:631)
Any idea what this means? I'm using Dagger for dependency injection, is that why it might not work?
You can try the latest version of the monkeytalk and i guess your problem will not occur again.

Categories

Resources