opentok-android-sdk-samples icon indicating copy to clipboard operation
opentok-android-sdk-samples copied to clipboard

crashed in Android 12

Open vmeditab opened this issue 3 years ago • 19 comments

OpenTok not working with android 12, below are the logs,

JNI DETECTED ERROR IN APPLICATION: JNI GetObjectClass called with pending exception java.lang.SecurityException: listen runtime.cc:677] at java.lang.Exception android.os.Parcel.createExceptionOrNull(int, java.lang.String) (Parcel.java:2425) runtime.cc:677] at java.lang.Exception android.os.Parcel.createException(int, java.lang.String) (Parcel.java:2409) runtime.cc:677] at void android.os.Parcel.readException(int, java.lang.String) (Parcel.java:2392) runtime.cc:677] at void android.os.Parcel.readException() (Parcel.java:2334) runtime.cc:677] at void com.android.internal.telephony.ITelephonyRegistry$Stub$Proxy.listenWithEventList(int, java.lang.String, java.lang.String, com.android.internal.telephony.IPhoneStateListener, int[], boolean) (ITelephonyRegistry.java:1036) runtime.cc:677] at void android.telephony.TelephonyRegistryManager.listenFromListener(int, java.lang.String, java.lang.String, android.telephony.PhoneStateListener, int, boolean) (TelephonyRegistryManager.java:250) runtime.cc:677] at void android.telephony.TelephonyManager.listen(android.telephony.PhoneStateListener, int) (TelephonyManager.java:5999) runtime.cc:677] at void com.opentok.android.DefaultAudioDevice.registerPhoneStateListener() (:-1) runtime.cc:677] at boolean com.opentok.android.DefaultAudioDevice.initRenderer() (:-1) runtime.cc:677] Caused by: android.os.RemoteException: Remote stack trace: runtime.cc:677] at com.android.internal.telephony.TelephonyPermissions.enforceCarrierPrivilege(TelephonyPermissions.java:634) runtime.cc:677] at com.android.internal.telephony.TelephonyPermissions.checkReadPhoneState(TelephonyPermissions.java:149) runtime.cc:677] at com.android.internal.telephony.TelephonyPermissions.checkCallingOrSelfReadPhoneState(TelephonyPermissions.java:94) runtime.cc:677] at com.android.server.TelephonyRegistry.checkListenerPermission(TelephonyRegistry.java:3092) runtime.cc:677] at com.android.server.TelephonyRegistry.listen(TelephonyRegistry.java:1024) runtime.cc:677] runtime.cc:677] (Throwable with no stack trace) runtime.cc:677] runtime.cc:677] in call to GetObjectClass A/libc: Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 32407 (Thread-16), pid 32211

vmeditab avatar Sep 17 '21 09:09 vmeditab

Same issue, crashing on Android 12 devices Device : Google pixel 3 Android 12 beta 5

2021-10-01 09:48:27.532 12675-13121/com.varsitytutors.tutoringtools E/rtc: # # Fatal error in: ../../../../src/sdk/android/src/jni/jni_helpers.cc, line 37 # last system error: 0 # Check failed: !jni->ExceptionCheck() # error during DeleteGlobalRef

When in a session alone things seem okay, as soon as another person enters the session and the SDK calls subscribe(subscriber) on a session object , there is a crash.

The logs are not very helpful and there is no way to set a logging level on Android to provide more details

Given Android is in beta 5 now, (), its probably a good time to investigate this.

Suspected issue: If the app starts some sort of pending intent after it calls subscribe, this could very well be the issue

References: Check out the android 12 supporting documentation

Thank you !

jrdaher avatar Oct 01 '21 13:10 jrdaher

Any updates on this ? I have not found a workaround yet. What about you @vmeditab ?

jrdaher avatar Oct 20 '21 14:10 jrdaher

I finally figured out why this issue is not happening in the demo of Vonage Basic-Video-Chat-java. They need to change targetSdkVersion to 31 inside the commons.gradle file and add exported "true" to the main activity. that will cause the crash we have on Android 12.

the crash will happen in onStreamReceived (...) { [...] session.subscribe(subscriber); << this line will go through fine by then a background crash will occur }

By changing the target SDK of the Vonage Android SDK to 31, the root cause of the issue will probably be highlighted in the compiler

As a temporary workaround @vmeditab you can just swap out your app's targeted SDK to 30 the crash will disappear.

Also make sure you are using the latest version of vonage sdk , at the time of writing its 2.21.0

jrdaher avatar Oct 20 '21 16:10 jrdaher

Hello @jrdaher, I didn't find any solution yet. My app just crashed after opening the video streaming screen. Do you find any solution? We have updated our target SDK to 31. Please share your answer if you found any update regarding this issue.

vmeditab avatar Oct 26 '21 07:10 vmeditab

Hello, we are moving to Android 12 and we see this issue as well... There seems no immediate workaround, at a first glance... Do we have an ETA on this? Do you need help moving this repo to SDK 31? Pull Request?

KirkBushman avatar Oct 26 '21 09:10 KirkBushman

Yes @KirkBushman. update sdk to 31.

vmeditab avatar Oct 26 '21 11:10 vmeditab

@igorwojda

KirkBushman avatar Oct 26 '21 11:10 KirkBushman

Any updates ? I tried sdk 30, 31 but not working with android 12.

HarshaKoshila avatar Nov 11 '21 20:11 HarshaKoshila

Magic Answer

  1. Change react-native opentok version 0.14.0
  2. Added android:exported="true" into activity of AndroidManifest file - (Android 12)
  3. Check your permission as below
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" /> 
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.RECORD_AUDIO" /> 
<uses-feature android:name="android.hardware.camera" android:required="true" />
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false" />
<uses-feature android:name="android.hardware.microphone" android:required="true" />

HarshaKoshila avatar Nov 12 '21 10:11 HarshaKoshila

Any update on this? I am getting a crash on the video stream while targeting Android 12:

    2021-11-15 11:48:39.973 2888-3448/com.cirrusmd.android.debug A/d.android.debu: java_vm_ext.cc:579] JNI DETECTED ERROR IN APPLICATION: JNI NewGlobalRef called with pending exception java.lang.SecurityException: listen
    java_vm_ext.cc:579]   at java.lang.Exception android.os.Parcel.createExceptionOrNull(int, java.lang.String) (Parcel.java:2425)
    java_vm_ext.cc:579]   at java.lang.Exception android.os.Parcel.createException(int, java.lang.String) (Parcel.java:2409)
    java_vm_ext.cc:579]   at void android.os.Parcel.readException(int, java.lang.String) (Parcel.java:2392)
    java_vm_ext.cc:579]   at void android.os.Parcel.readException() (Parcel.java:2334)
    java_vm_ext.cc:579]   at void com.android.internal.telephony.ITelephonyRegistry$Stub$Proxy.listenWithEventList(int, java.lang.String, java.lang.String, com.android.internal.telephony.IPhoneStateListener, int[], boolean) (ITelephonyRegistry.java:1036)
    java_vm_ext.cc:579]   at void android.telephony.TelephonyRegistryManager.listenFromListener(int, java.lang.String, java.lang.String, android.telephony.PhoneStateListener, int, boolean) (TelephonyRegistryManager.java:250)
    java_vm_ext.cc:579]   at void android.telephony.TelephonyManager.listen(android.telephony.PhoneStateListener, int) (TelephonyManager.java:5999)
    java_vm_ext.cc:579]   at void com.opentok.android.DefaultAudioDevice.registerPhoneStateListener() (SourceFile:-1)
    java_vm_ext.cc:579]   at boolean com.opentok.android.DefaultAudioDevice.initRenderer() (SourceFile:-1)
    java_vm_ext.cc:579] Caused by: android.os.RemoteException: Remote stack trace:
    java_vm_ext.cc:579] 	at com.android.internal.telephony.TelephonyPermissions.enforceCarrierPrivilege(TelephonyPermissions.java:634)
    java_vm_ext.cc:579] 	at com.android.internal.telephony.TelephonyPermissions.checkReadPhoneState(TelephonyPermissions.java:149)
    java_vm_ext.cc:579] 	at com.android.internal.telephony.TelephonyPermissions.checkCallingOrSelfReadPhoneState(TelephonyPermissions.java:94)
    java_vm_ext.cc:579] 	at com.android.server.TelephonyRegistry.checkListenerPermission(TelephonyRegistry.java:3092)
    java_vm_ext.cc:579] 	at com.android.server.TelephonyRegistry.listen(TelephonyRegistry.java:1024)
    java_vm_ext.cc:579] 
    java_vm_ext.cc:579] (Throwable with no stack trace)
    java_vm_ext.cc:579] 
    java_vm_ext.cc:579]     in call to NewGlobalRef

DanielGalarza avatar Nov 15 '21 19:11 DanielGalarza

I've opened a ticket on their internal ticketing system, they acknowledged the issue, but they cannot give an ETA for now. They cannot provide a workaround, it seems the only way for now to use it is to stay on API 30.

KirkBushman avatar Nov 15 '21 22:11 KirkBushman

I've opened a ticket on their internal ticketing system, they acknowledged the issue, but they cannot give an ETA for now. They cannot provide a workaround, it seems the only way for now to use it is to stay on API 30.

Thanks for doing that!!

I am having issues on Android 12 devices, even when I stay on API 30. I don't have a work around at all...

DanielGalarza avatar Nov 22 '21 21:11 DanielGalarza

Hi, I'm having the same crash... any solution yet? Target version 31 Fatal error in: ../../../../src/sdk/android/src/jni/jni_helpers.cc, line 37

digitalmidges avatar Nov 27 '21 22:11 digitalmidges

I added this to the AndroidManifest.xml and it works:

        android:name="android.permission.READ_PHONE_STATE"
        tools:remove="android:maxSdkVersion" />

uriel-frankel avatar Dec 16 '21 17:12 uriel-frankel

Also getting a crash trying to subscribe to a session from an Android 12 device, targering API level 31:

A/libc: Fatal signal 6 (SIGABRT), code -6 (SI_TKILL) in tid 7712 (Thread-41), pid 6868

2021-12-24 10:21:36.515 7726-7726/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
2021-12-24 10:21:36.515 7726-7726/? A/DEBUG: Build fingerprint: 'google/sdk_gphone64_x86_64/emulator64_x86_64_arm64:12/SE1A.211012.001/7818354:userdebug/dev-keys'
2021-12-24 10:21:36.515 7726-7726/? A/DEBUG: Revision: '0'
2021-12-24 10:21:36.515 7726-7726/? A/DEBUG: ABI: 'x86_64'
2021-12-24 10:21:36.515 7726-7726/? A/DEBUG: Timestamp: 2021-12-24 10:21:35.500554878+0100
2021-12-24 10:21:36.515 7726-7726/? A/DEBUG: Process uptime: 0s
2021-12-24 10:21:36.515 7726-7726/? A/DEBUG: Cmdline: APP_NAME
2021-12-24 10:21:36.516 7726-7726/? A/DEBUG: pid: 6868, tid: 7712, name: Thread-41  >>> APP_NAME <<<
2021-12-24 10:21:36.516 7726-7726/? A/DEBUG: uid: 10148
2021-12-24 10:21:36.516 7726-7726/? A/DEBUG: signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
2021-12-24 10:21:36.516 7726-7726/? A/DEBUG:     rax 0000000000000000  rbx 0000000000001ad4  rcx 00007cd64bf2c5cf  rdx 0000000000000006
2021-12-24 10:21:36.516 7726-7726/? A/DEBUG:     r8  00007cd4758c7f10  r9  00007cd4758c7f10  r10 00007cd33db581c0  r11 0000000000000207
2021-12-24 10:21:36.516 7726-7726/? A/DEBUG:     r12 00007cd328586b28  r13 00007cd5259b1850  r14 00007cd33db581b8  r15 0000000000001e20
2021-12-24 10:21:36.516 7726-7726/? A/DEBUG:     rdi 0000000000001ad4  rsi 0000000000001e20
2021-12-24 10:21:36.516 7726-7726/? A/DEBUG:     rbp 00007cd64bfa5730  rsp 00007cd33db581b0  rip 00007cd64bf2c5cf
2021-12-24 10:21:36.516 7726-7726/? A/DEBUG: backtrace:
2021-12-24 10:21:36.516 7726-7726/? A/DEBUG:       #00 pc 000000000005e5cf  /apex/com.android.runtime/lib64/bionic/libc.so (abort+191) (BuildId: 5db8d317d3741b337ef046540bbdd0f7)
2021-12-24 10:21:36.516 7726-7726/? A/DEBUG:       #01 pc 00000000002cc9be  /data/app/~~DIpXQR8PqtxFNZ6tyiL6iQ==/APP_NAME-QxenZa6_RS0SmCug8g28rA==/base.apk!libopentok.so (BuildId: 2b8fcdfcb19e597ab847e45942ed4e76e07b8194)
2021-12-24 10:21:36.516 7726-7726/? A/DEBUG:       #02 pc 00000000004dd5b1  /data/app/~~DIpXQR8PqtxFNZ6tyiL6iQ==/APP_NAME-QxenZa6_RS0SmCug8g28rA==/base.apk!libopentok.so (BuildId: 2b8fcdfcb19e597ab847e45942ed4e76e07b8194)
2021-12-24 10:21:36.516 7726-7726/? A/DEBUG:       #03 pc 00000000000f78a5  /data/app/~~DIpXQR8PqtxFNZ6tyiL6iQ==/APP_NAME-QxenZa6_RS0SmCug8g28rA==/base.apk!libopentok.so (BuildId: 2b8fcdfcb19e597ab847e45942ed4e76e07b8194)
2021-12-24 10:21:36.516 7726-7726/? A/DEBUG:       #04 pc 00000000000f79e8  /data/app/~~DIpXQR8PqtxFNZ6tyiL6iQ==/APP_NAME-QxenZa6_RS0SmCug8g28rA==/base.apk!libopentok.so (BuildId: 2b8fcdfcb19e597ab847e45942ed4e76e07b8194)
2021-12-24 10:21:36.516 7726-7726/? A/DEBUG:       #05 pc 00000000002c5a85  /data/app/~~DIpXQR8PqtxFNZ6tyiL6iQ==/APP_NAME-QxenZa6_RS0SmCug8g28rA==/base.apk!libopentok.so (BuildId: 2b8fcdfcb19e597ab847e45942ed4e76e07b8194)
2021-12-24 10:21:36.516 7726-7726/? A/DEBUG:       #06 pc 00000000002c5a52  /data/app/~~DIpXQR8PqtxFNZ6tyiL6iQ==/APP_NAME-QxenZa6_RS0SmCug8g28rA==/base.apk!libopentok.so (BuildId: 2b8fcdfcb19e597ab847e45942ed4e76e07b8194)
2021-12-24 10:21:36.516 7726-7726/? A/DEBUG:       #07 pc 00000000002c6a4e  /data/app/~~DIpXQR8PqtxFNZ6tyiL6iQ==/APP_NAME-QxenZa6_RS0SmCug8g28rA==/base.apk!libopentok.so (BuildId: 2b8fcdfcb19e597ab847e45942ed4e76e07b8194)
2021-12-24 10:21:36.517 7726-7726/? A/DEBUG:       #08 pc 00000000002c6b48  /data/app/~~DIpXQR8PqtxFNZ6tyiL6iQ==/APP_NAME-QxenZa6_RS0SmCug8g28rA==/base.apk!libopentok.so (BuildId: 2b8fcdfcb19e597ab847e45942ed4e76e07b8194)
2021-12-24 10:21:36.517 7726-7726/? A/DEBUG:       #09 pc 00000000001c23fc  /data/app/~~DIpXQR8PqtxFNZ6tyiL6iQ==/APP_NAME-QxenZa6_RS0SmCug8g28rA==/base.apk!libopentok.so (BuildId: 2b8fcdfcb19e597ab847e45942ed4e76e07b8194)
2021-12-24 10:21:36.518 7726-7726/? A/DEBUG:       #10 pc 0000000000426119  /data/app/~~DIpXQR8PqtxFNZ6tyiL6iQ==/APP_NAME-QxenZa6_RS0SmCug8g28rA==/base.apk!libopentok.so (BuildId: 2b8fcdfcb19e597ab847e45942ed4e76e07b8194)
2021-12-24 10:21:36.519 7726-7726/? A/DEBUG:       #11 pc 000000000042171d  /data/app/~~DIpXQR8PqtxFNZ6tyiL6iQ==/APP_NAME-QxenZa6_RS0SmCug8g28rA==/base.apk!libopentok.so (BuildId: 2b8fcdfcb19e597ab847e45942ed4e76e07b8194)
2021-12-24 10:21:36.519 7726-7726/? A/DEBUG:       #12 pc 0000000000272975  /data/app/~~DIpXQR8PqtxFNZ6tyiL6iQ==/APP_NAME-QxenZa6_RS0SmCug8g28rA==/base.apk!libopentok.so (BuildId: 2b8fcdfcb19e597ab847e45942ed4e76e07b8194)
2021-12-24 10:21:36.519 7726-7726/? A/DEBUG:       #13 pc 0000000000202b75  /data/app/~~DIpXQR8PqtxFNZ6tyiL6iQ==/APP_NAME-QxenZa6_RS0SmCug8g28rA==/base.apk!libopentok.so (BuildId: 2b8fcdfcb19e597ab847e45942ed4e76e07b8194)
2021-12-24 10:21:36.519 7726-7726/? A/DEBUG:       #14 pc 00000000002acc9d  /data/app/~~DIpXQR8PqtxFNZ6tyiL6iQ==/APP_NAME-QxenZa6_RS0SmCug8g28rA==/base.apk!libopentok.so (BuildId: 2b8fcdfcb19e597ab847e45942ed4e76e07b8194)
2021-12-24 10:21:36.519 7726-7726/? A/DEBUG:       #15 pc 00000000002abfd3  /data/app/~~DIpXQR8PqtxFNZ6tyiL6iQ==/APP_NAME-QxenZa6_RS0SmCug8g28rA==/base.apk!libopentok.so (BuildId: 2b8fcdfcb19e597ab847e45942ed4e76e07b8194)
2021-12-24 10:21:36.519 7726-7726/? A/DEBUG:       #16 pc 00000000002ab7d2  /data/app/~~DIpXQR8PqtxFNZ6tyiL6iQ==/APP_NAME-QxenZa6_RS0SmCug8g28rA==/base.apk!libopentok.so (BuildId: 2b8fcdfcb19e597ab847e45942ed4e76e07b8194)
2021-12-24 10:21:36.519 7726-7726/? A/DEBUG:       #17 pc 00000000002aaa63  /data/app/~~DIpXQR8PqtxFNZ6tyiL6iQ==/APP_NAME-QxenZa6_RS0SmCug8g28rA==/base.apk!libopentok.so (BuildId: 2b8fcdfcb19e597ab847e45942ed4e76e07b8194)
2021-12-24 10:21:36.520 7726-7726/? A/DEBUG:       #18 pc 00000000002abc48  /data/app/~~DIpXQR8PqtxFNZ6tyiL6iQ==/APP_NAME-QxenZa6_RS0SmCug8g28rA==/base.apk!libopentok.so (BuildId: 2b8fcdfcb19e597ab847e45942ed4e76e07b8194)
2021-12-24 10:21:36.520 7726-7726/? A/DEBUG:       #19 pc 00000000000c758a  /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+58) (BuildId: 5db8d317d3741b337ef046540bbdd0f7)
2021-12-24 10:21:36.520 7726-7726/? A/DEBUG:       #20 pc 000000000005fd87  /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+55) (BuildId: 5db8d317d3741b337ef046540bbdd0f7)
2021-12-24 10:21:36.589 244-244/? E/tombstoned: Tombstone written to: tombstone_00

rokoblak24 avatar Dec 27 '21 15:12 rokoblak24

fyi a version was just released to address this issue

jrdaher avatar Jan 20 '22 21:01 jrdaher

Can you send me the link @jrdaher ?

vmeditab avatar Jan 21 '22 05:01 vmeditab

@vmeditab https://tokbox.com/developer/sdks/android/release-notes.html Here's the release notes. Looks like it's version 2.21.4

UPDATE: Just tested on my build, which targets Android 12, and it's working! 🎊

DanielGalarza avatar Jan 21 '22 17:01 DanielGalarza

Seems to be working for our build 🙂

KirkBushman avatar Jan 23 '22 12:01 KirkBushman

Glad that 2.21.4 help :-)

Closing.

v-kpheng avatar Sep 28 '22 01:09 v-kpheng

facing this same telephony issue , i am not using telephony in my app and i am new , can someone tell how to add telephony and fix this

Amitkumar-15 avatar Dec 14 '22 10:12 Amitkumar-15