opentok / opentok-react-native

OpenTok React Native - a library for OpenTok iOS and Android SDKs
https://tokbox.com/
MIT License
209 stars 155 forks source link

Android crash on startup (Exception java.lang.RuntimeException) #617

Open ndlonghi opened 1 year ago

ndlonghi commented 1 year ago

Bug Report

Current behavior

Android app crashes only for some android devices (CPH2263, SM-G965F, Redmi Note 8 Pro, SM-N975F, SM-A505FN, Infinix X688B, SM-G950F, etc) when rendering OTSession.

Steps to reproduce

Sorry, couldn't reproduce the issue because it only happens on some devices. These are details: "react-native": "0.69.4" buildToolsVersion = "31.0.0" minSdkVersion = 21 compileSdkVersion = 32 targetSdkVersion = 31 Android version of the devices with crashes: 11, 10, 9

This issue appeared when we upgraded to "opentok-react-native": "0.20.4" (this was required to upgrade to react native 0.69). Disappeared when reverted back to 0.20.1.

Example Project

(If possible, please create an example project here on GitHub.com that exhibits the problematic behaviour, and link to it here in the bug report)

What is the current bug behavior?

App crashes

What is the expected correct behavior?

App shouldn't crash

Relevant logs and/or screenshots

Exception java.lang.RuntimeException:
  at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$getRunnable$0$LoadedApk$ReceiverDispatcher$Args (LoadedApk.java:1723)
  at android.app.-$$Lambda$LoadedApk$ReceiverDispatcher$Args$_BumDX2UKsnxLVrE6UJsJZkotuA.run
  at android.os.Handler.handleCallback (Handler.java:938)
  at android.os.Handler.dispatchMessage (Handler.java:99)
  at android.os.Looper.loop (Looper.java:263)
  at android.app.ActivityThread.main (ActivityThread.java:8317)
  at java.lang.reflect.Method.invoke
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:612)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1006)
Caused by java.lang.NullPointerException: Attempt to invoke virtual method 'com.opentok.android.BaseAudioDevice$BluetoothState com.opentok.android.BluetoothManager.getBluetoothState()' on a null object reference
  at com.opentok.android.DefaultAudioDevice.getBluetoothState
  at com.opentok.android.DefaultAudioDevice.setOutputMode
  at com.opentok.android.BluetoothManager$2.onReceive
  at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$getRunnable$0$LoadedApk$ReceiverDispatcher$Args (LoadedApk.java:1688)

NullPointerException Attempt to invoke virtual method 'com.opentok.android.BaseAudioDevice$BluetoothState com.opentok.android.BluetoothManager.getBluetoothState()' on a null object reference

com.opentok.android.DefaultAudioDevice in getBluetoothState at line 2
com.opentok.android.DefaultAudioDevice in setOutputMode at line 73
com.opentok.android.BluetoothManager$2 in onReceive at line 254
android.app.LoadedApk$ReceiverDispatcher$Args in lambda$getRunnable$0 at line 1397
android.app.-$$Lambda$LoadedApk$ReceiverDispatcher$Args$_BumDX2UKsnxLVrE6UJsJZkotuA in run at line 2
android.os.Handler in handleCallback at line 873
android.os.Handler in dispatchMessage at line 99
android.os.Looper in loop at line 201
android.app.ActivityThread in main at line 6826
java.lang.reflect.Method in invoke
com.android.internal.os.RuntimeInit$MethodAndArgsCaller in run at line 547
com.android.internal.os.ZygoteInit in main at line 873
enricop89 commented 1 year ago

Which Android version are you running?

enricop89 commented 1 year ago

Applications targeting API level 31 and above now require permission BLUETOOTH_CONNECT in addition to the other required permissions.Additionally, applications targeting API level 31 and above now require permission BLUETOOTH_CONNECT in addition to the other required permissions.

https://tokbox.com/developer/sdks/android/release-notes.html

snehaJain8 commented 11 months ago

Hi, is there any update on this ?

pietgk commented 9 months ago

any status update?

beHaze commented 1 week ago

We have released 2.27.6, try with this version. Please reach out to Vonage support (https://api.support.vonage.com/hc/en-us) if you’re still facing issues.