gpt4 book ai didi

android - OpenTok 不适用于较旧的 Android(可能缺少 org/webrtc/voiceengine/BuildInfo.class)

转载 作者:行者123 更新时间:2023-11-30 00:16:09 24 4
gpt4 key购买 nike

我有一个带有 OpenTok View 的 React Native Android 应用程序(编写为 native 模块)。我在任何 OpenTok session 中遇到崩溃问题(在尝试实例化 OpenTok View 时立即发生)影响旧的 Android 版本(SDK 16-19,Jelly Bean 到 KitKat)。最近的 Android 手机没有问题; OpenTok 完美运行。

这是相关的 Android logcat 输出:

11-12 16:30:12.993 2949-2949/com.myapp I/OpenTokUnifiedView: APIKEY Connect Session
11-12 16:30:13.003 2949-2949/com.myapp I/OpenTokUnifiedView: apiKey: ********** sessionId: ********** token: **********
11-12 16:30:13.023 2949-2949/com.myapp I/dalvikvm: threadid=1: recursive native library load attempt (/data/app-lib/com.myapp-1/libopentok.so)
11-12 16:30:13.033 2949-2949/com.myapp I/dalvikvm: threadid=1: recursive native library load attempt (/data/app-lib/com.myapp-1/libopentok.so)
11-12 16:30:13.033 2949-2949/com.myapp I/dalvikvm: threadid=1: recursive native library load attempt (/data/app-lib/com.myapp-1/libopentok.so)
11-12 16:30:13.033 2949-2949/com.myapp I/dalvikvm: threadid=1: recursive native library load attempt (/data/app-lib/com.myapp-1/libopentok.so)
11-12 16:30:13.033 2949-2949/com.myapp I/dalvikvm: threadid=1: recursive native library load attempt (/data/app-lib/com.myapp-1/libopentok.so)
11-12 16:30:13.053 2949-2949/com.myapp E/BluetoothAdapter: Bluetooth binder is null
11-12 16:30:13.063 2949-2949/com.myapp W/System.err: java.lang.NoClassDefFoundError: org/webrtc/voiceengine/BuildInfo
11-12 16:30:13.063 2949-2949/com.myapp W/System.err: at com.opentok.android.Session.init(Native Method)
11-12 16:30:13.063 2949-2949/com.myapp W/System.err: at com.opentok.android.Session.<init>(Session.java:710)
11-12 16:30:13.063 2949-2949/com.myapp W/System.err: at com.opentok.android.Session$Builder.build(Session.java:588)
11-12 16:30:13.063 2949-2949/com.myapp W/System.err: at com.myapp.OpenTokUnifiedView.connectSession(OpenTokUnifiedView.java:114)
11-12 16:30:13.063 2949-2949/com.myapp W/System.err: at com.myapp.OpenTokUnifiedView.setApiKey(OpenTokUnifiedView.java:72)
11-12 16:30:13.063 2949-2949/com.myapp W/System.err: at com.myapp.OpenTokUnifiedViewManager.setApiKey(OpenTokUnifiedViewManager.java:34)
11-12 16:30:13.063 2949-2949/com.myapp W/System.err: at java.lang.reflect.Method.invokeNative(Native Method)
11-12 16:30:13.063 2949-2949/com.myapp W/System.err: at java.lang.reflect.Method.invoke(Method.java:515)
11-12 16:30:13.063 2949-2949/com.myapp W/System.err: at com.facebook.react.uimanager.ViewManagersPropertyCache$PropSetter.updateViewProp(ViewManagersPropertyCache.java:83)
11-12 16:30:13.063 2949-2949/com.myapp W/System.err: at com.facebook.react.uimanager.ViewManagerPropertyUpdater$FallbackViewManagerSetter.setProperty(ViewManagerPropertyUpdater.java:129)
11-12 16:30:13.063 2949-2949/com.myapp W/System.err: at com.facebook.react.uimanager.ViewManagerPropertyUpdater.updateProps(ViewManagerPropertyUpdater.java:48)
11-12 16:30:13.063 2949-2949/com.myapp W/System.err: at com.facebook.react.uimanager.ViewManager.updateProperties(ViewManager.java:34)
11-12 16:30:13.063 2949-2949/com.myapp W/System.err: at com.facebook.react.uimanager.NativeViewHierarchyManager.createView(NativeViewHierarchyManager.java:227)
11-12 16:30:13.063 2949-2949/com.myapp W/System.err: at com.facebook.react.uimanager.UIViewOperationQueue$CreateViewOperation.execute(UIViewOperationQueue.java:153)
11-12 16:30:13.063 2949-2949/com.myapp W/System.err: at com.facebook.react.uimanager.UIViewOperationQueue$1.run(UIViewOperationQueue.java:809)
11-12 16:30:13.063 2949-2949/com.myapp W/System.err: at com.facebook.react.uimanager.UIViewOperationQueue.flushPendingBatches(UIViewOperationQueue.java:922)
11-12 16:30:13.063 2949-2949/com.myapp W/System.err: at com.facebook.react.uimanager.UIViewOperationQueue.access$2100(UIViewOperationQueue.java:47)
11-12 16:30:13.063 2949-2949/com.myapp W/System.err: at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.doFrameGuarded(UIViewOperationQueue.java:982)
11-12 16:30:13.063 2949-2949/com.myapp W/System.err: at com.facebook.react.uimanager.GuardedFrameCallback.doFrame(GuardedFrameCallback.java:31)
11-12 16:30:13.063 2949-2949/com.myapp W/System.err: at com.facebook.react.modules.core.ReactChoreographer$ReactChoreographerDispatcher.doFrame(ReactChoreographer.java:136)
11-12 16:30:13.063 2949-2949/com.myapp W/System.err: at com.facebook.react.modules.core.ChoreographerCompat$FrameCallback$1.doFrame(ChoreographerCompat.java:107)
11-12 16:30:13.063 2949-2949/com.myapp W/System.err: at android.view.Choreographer$CallbackRecord.run(Choreographer.java:759)
11-12 16:30:13.063 2949-2949/com.myapp W/System.err: at android.view.Choreographer.doCallbacks(Choreographer.java:574)
11-12 16:30:13.063 2949-2949/com.myapp W/System.err: at android.view.Choreographer.doFrame(Choreographer.java:543)
11-12 16:30:13.063 2949-2949/com.myapp W/System.err: at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
11-12 16:30:13.063 2949-2949/com.myapp W/System.err: at android.os.Handler.handleCallback(Handler.java:733)
11-12 16:30:13.063 2949-2949/com.myapp W/System.err: at android.os.Handler.dispatchMessage(Handler.java:95)
11-12 16:30:13.063 2949-2949/com.myapp W/System.err: at android.os.Looper.loop(Looper.java:136)
11-12 16:30:13.063 2949-2949/com.myapp W/System.err: at android.app.ActivityThread.main(ActivityThread.java:5017)
11-12 16:30:13.063 2949-2949/com.myapp W/System.err: at java.lang.reflect.Method.invokeNative(Native Method)
11-12 16:30:13.063 2949-2949/com.myapp W/System.err: at java.lang.reflect.Method.invoke(Method.java:515)
11-12 16:30:13.063 2949-2949/com.myapp W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
11-12 16:30:13.063 2949-2949/com.myapp W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
11-12 16:30:13.063 2949-2949/com.myapp W/System.err: at dalvik.system.NativeStart.main(Native Method)
11-12 16:30:13.063 2949-2949/com.myapp W/System.err: Caused by: java.lang.ClassNotFoundException: Didn't find class "org.webrtc.voiceengine.BuildInfo" on path: DexPathList[[zip file "/data/app/com.myapp-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.myapp-1, /vendor/lib, /system/lib]]
11-12 16:30:13.063 2949-2949/com.myapp W/System.err: at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
11-12 16:30:13.063 2949-2949/com.myapp W/System.err: at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
11-12 16:30:13.063 2949-2949/com.myapp W/System.err: at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
11-12 16:30:13.063 2949-2949/com.myapp W/System.err: ... 34 more
11-12 16:30:13.063 2949-2949/com.myapp E/rtc: #
# Fatal error in ../../webrtc/modules/utility/source/helpers_android.cc, line 68
# last system error: 2
# Check failed: !jni->ExceptionCheck()
# Error during FindClass: org/webrtc/voiceengine/BuildInfo
#
11-12 16:30:13.063 2949-2949/com.myapp A/libc: Fatal signal 6 (SIGABRT) at 0x00000b85 (code=-6), thread 2949 (ale.app.staging)

由于看起来缺少 org/webrtc/voiceengine/BuildInfo.class,我手动将 audio_device_java.jar 添加为库(按照 https://groups.google.com/forum/#!topic/discuss-webrtc/PkfAVr_TYQs 上的建议)以查看它是否解决了问题。

但是,当我尝试构建时,OpenTok SDK 似乎已经有了它,因此手动添加 audio_device_java.jar 没有帮助:

:app:transformClassesWithJarMergingForDebug FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: org/webrtc/voiceengine/BuildInfo.class

不确定为什么旧版 Android 上的应用程序缺少 org/webrtc/voiceengine/BuildInfo.class。在较旧的 Android 上会发生什么?

编辑:我发现这实际上适用于 Lollipop——修改了这个问题以反射(reflect)该问题影响到 SDK 19 (KitKat)。

最佳答案

终于自己解决了!在此张贴,以便其他人可能会觉得有用。

我将 multiDexEnabled 设置为 true,因此我需要明确指定某些类以保留旧平台以正确使用 OpenTok(SDK 19 及更早版本)。

这意味着我必须在我的 app/build.gradle defaultConfig 中包含 multiDexKeepProguard:

defaultConfig {
...
multiDexEnabled true
multiDexKeepProguard file('proguard-rules.pro')
...
}

在我的 multiDexKeepProguard 文件中(我的恰好是 app 目录中名为 proguard-rules.pro 的文本文件),我有确保包括以下几行:

# Keep the following for OpenTok
-keep class com.opentok.** { *; }
-keep class org.webrtc.** { *; }

这让我的 OpenTok 移动应用程序可以在 SDK 16(Android 4.1 Jelly Bean)到 SDK 27(Android 8.1 Oreo)上正常工作。

关于android - OpenTok 不适用于较旧的 Android(可能缺少 org/webrtc/voiceengine/BuildInfo.class),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47255842/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com