react-native: getting this error on android

Description

Exception com.facebook.react.common.JavascriptException: at com.facebook.react.modules.core.ExceptionsManagerModule.reportException (ExceptionsManagerModule.java:72) at java.lang.reflect.Method.invoke 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 at android.os.Handler.handleCallback (Handler.java:751) at android.os.Handler.dispatchMessage (Handler.java:95) at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage (MessageQueueThreadHandler.java:27) at android.os.Looper.loop (Looper.java:154) at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run (MessageQueueThreadImpl.java:226) at java.lang.Thread.run (Thread.java:762)

React Native Version

0.71.8

Output of npx react-native info

System: OS: macOS 13.4 CPU: (12) x64 Intel® Core™ i5-10500 CPU @ 3.10GHz Memory: 40.75 MB / 8.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 18.16.0 - ~/.nvm/versions/node/v18.16.0/bin/node Yarn: 1.22.19 - ~/.nvm/versions/node/v18.16.0/bin/yarn npm: 9.5.1 - ~/.nvm/versions/node/v18.16.0/bin/npm Watchman: Not Found Managers: CocoaPods: 1.12.1 - /Users/mrsants/.rbenv/shims/pod SDKs: iOS SDK: Platforms: DriverKit 22.4, iOS 16.4, macOS 13.3, tvOS 16.4, watchOS 9.4 Android SDK: Not Found IDEs: Android Studio: 2022.2 AI-222.4459.24.2221.10121639 Xcode: 14.3.1/14E300c - /usr/bin/xcodebuild Languages: Java: 11.0.19 - /usr/local/opt/openjdk@11/bin/javac npmPackages: @react-native-community/cli: Not Found react: 18.2.0 => 18.2.0 react-native: 0.71.8 => 0.71.8 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found

Steps to reproduce

"expo": "~48.0.18",
"react-native": "0.71.8"

Snack, code example, screenshot, or link to a repository

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 2
  • Comments: 17 (2 by maintainers)

Most upvoted comments

same issue here.

Same issue here! @mrsants did you fix it or not yet

Issue still there just right after trying to upgrade the Android to use the targetSdkVersion = 33 I’ve tried many options but the APK keep crashing, when connecting the same device with USB cable it’s not crashing at all.

Where I can have more details about such bug? it’s not printed anywhere.

In Google play console I have the below error only

com.facebook.react.common.JavascriptException samsung b0q (Galaxy S22 Ultra) - Android 13 (SDK 33)

Exception com.facebook.react.common.JavascriptException: at com.facebook.react.modules.core.ExceptionsManagerModule.reportException (ExceptionsManagerModule.java:83) at java.lang.reflect.Method.invoke at com.facebook.react.bridge.JavaMethodWrapper.invoke (JavaMethodWrapper.java:372) at com.facebook.react.bridge.JavaModuleWrapper.invoke (JavaModuleWrapper.java:151) at com.facebook.react.bridge.queue.NativeRunnable.run at android.os.Handler.handleCallback (Handler.java:942) at android.os.Handler.dispatchMessage (Handler.java:99) at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage (MessageQueueThreadHandler.java:27) at android.os.Looper.loopOnce (Looper.java:226) at android.os.Looper.loop (Looper.java:313) at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run (MessageQueueThreadImpl.java:226) at java.lang.Thread.run (Thread.java:1012)

Anyone have any directions here?

Thanks in advance,

Can you share the file content of “DeviceModule.kt”?

Path: packages/expo-device/android/src/main/java/expo/modules/device/DeviceModule.kt (Inside the Android Studio).

Screen Shot 2024-03-25 at 18 54 42

Fast way to resolve it and it’s actually worked fine for me.

Access Android studio, Search for “DeviceModule.kt” file,

In the file, search for the below line: “deviceName” to Settings.Secure.getString(mContext.contentResolver, “bluetooth_name”)

Replace it with the below lines: “deviceName” to run { if (Build.VERSION.SDK_INT <= 31) Settings.Secure.getString(mContext.contentResolver, “bluetooth_name”) else Settings.Global.getString(mContext.contentResolver, Settings.Global.DEVICE_NAME) },

Source: https://github.com/expo/expo/pull/19666/files

I’ve tested the APK version from Google play and working fine.

Closing as @mrsants is unresponsive

Not enough information to debug this. You need to provide a reproducer, codesnippet or a Snack. We can’t just support with basically just a stacktrace.