错误膨胀 class com.twilio.video.VideoView

Error inflating class com.twilio.video.VideoView

我目前正在将 Twilio Video 与我的 AIR 应用程序集成。当我在 activity 布局中尝试 Twilio VideoView 时,出现错误 "Error inflating class com.twilio.video.VideoView"

这是我的布局

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#FFFFFF"
    android:orientation="vertical"
    tools:context="com.nethram.videoextn.views.MainActivity">

    <Button
    android:id="@+id/testBtn"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:onClick="clickHandler"
    android:text="@string/click" />

    <com.twilio.video.VideoView
    android:id="@+id/videoView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"/>

</LinearLayout>

我反编译了用于生成ane扩展文件的jar文件,以检查是否包含Twilio视频包。 Twilio视频包包含在生成的jar文件中。

这是我得到的错误

E/AndroidRuntime: FATAL EXCEPTION: main
                                                   Process: air.VideoApp, PID: 27627
                                                   java.lang.RuntimeException: Unable to start activity ComponentInfo{air.VideoApp/com.nethram.videoextn.views.MainActivity}: android.view.InflateException: Binary XML file line #16: Binary XML file line #16: Error inflating class com.twilio.video.VideoView
                                                       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2456)
                                                       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2539)
                                                       at android.app.ActivityThread.access0(ActivityThread.java:159)
                                                       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1384)
                                                       at android.os.Handler.dispatchMessage(Handler.java:102)
                                                       at android.os.Looper.loop(Looper.java:152)
                                                       at android.app.ActivityThread.main(ActivityThread.java:5507)
                                                       at java.lang.reflect.Method.invoke(Native Method)
                                                       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                                       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
                                                    Caused by: android.view.InflateException: Binary XML file line #16: Binary XML file line #16: Error inflating class com.twilio.video.VideoView
                                                       at android.view.LayoutInflater.inflate(LayoutInflater.java:539)
                                                       at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
                                                       at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
                                                       at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:401)
                                                       at android.app.Activity.setContentView(Activity.java:2196)
                                                       at com.nethram.videoextn.views.MainActivity.onCreate(MainActivity.java:26)
                                                       at android.app.Activity.performCreate(Activity.java:6304)
                                                       at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
                                                       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2409)
                                                       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2539) 
                                                       at android.app.ActivityThread.access0(ActivityThread.java:159) 
                                                       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1384) 
                                                       at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                       at android.os.Looper.loop(Looper.java:152) 
                                                       at android.app.ActivityThread.main(ActivityThread.java:5507) 
                                                       at java.lang.reflect.Method.invoke(Native Method) 
                                                       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
                                                       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 
                                                    Caused by: android.view.InflateException: Binary XML file line #16: Error inflating class com.twilio.video.VideoView
                                                       at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:776)
                                                       at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
                                                       at android.view.LayoutInflater.rInflate(LayoutInflater.java:835)
                                                       at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
                                                       at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
                                                       at android.view.LayoutInflater.inflate(LayoutInflater.java:423) 
                                                       at android.view.LayoutInflater.inflate(LayoutInflater.java:374) 
                                                       at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:401) 
                                                       at android.app.Activity.setContentView(Activity.java:2196) 
                                                       at com.nethram.videoextn.views.MainActivity.onCreate(MainActivity.java:26) 
                                                       at android.app.Activity.performCreate(Activity.java:6304) 
                                                       at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118) 
                                                       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2409) 
                                                       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2539) 
                                                       at android.app.ActivityThread.access0(ActivityThread.java:159) 
                                                       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1384) 
                                                       at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                       at android.os.Looper.loop(Looper.java:152) 
                                                       at android.app.ActivityThread.main(ActivityThread.java:5507) 
                                                       at java.lang.reflect.Method.invoke(Native Method) 
                                                       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
                                                       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 
                                                    Caused by: java.lang.ClassNotFoundException: Didn't find class "com.twilio.video.VideoView" on path: DexPathList[[zip file "/data/app/air.VideoApp-1/base.apk"],nativeLibraryDirectories=[/data/app/air.VideoApp-1/lib/arm, /data/app/air.VideoApp-1/base.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]]
                                                       at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
                                                       at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
                                                       at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
                                                       at android.view.LayoutInflater.createView(LayoutInflater.java:583)
                                                       at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:764)
                                                       at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704) 
                                                       at android.view.LayoutInflater.rInflate(LayoutInflater.java:835) 
                                                       at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798) 
                                                       at android.view.LayoutInflater.inflate(LayoutInflater.java:515) 
                                                       at android.view.LayoutInflater.inflate(LayoutInflater.java:423) 
                                                       at android.view.LayoutInflater.inflate(LayoutInflater.java:374) 
                                                       at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:401) 
                                                       at android.app.Activity.setContentView(Activity.java:2196) 
                                                       at com.nethram.videoextn.views.MainActivity.onCreate(MainActivity.java:26) 
                                                       at android.app.Activity.performCreate(Activity.java:6304) 
                                                       at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118) 
                                                       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2409) 
                                                       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2539) 
                                                       at android.app.ActivityThread.access0(ActivityThread.java:159) 
                                                       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1384) 
                                                       at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                       at android.os.Looper.loop(Looper.java:152) 
                                                       at android.app.ActivityThread.main(ActivityThread.java:5507) 
                                                       at java.lang.reflect.Method.invoke(Native Method) 
                                                       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
                                                       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 
                                                    Suppressed: java.lang.ClassNotFoundException: com.twilio.video.VideoView
                                                       at java.lang.Class.classForName(Native Method)
                                                       at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
                                                       at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
                                                       at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
                                                            ... 24 more
                                                    Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available

知道如何解决这个问题。找到了一些关于错误类型的答案,但这些都没有帮助我

以前我使用的是 AIR SDK 版本 16,旧的 SDK 版本没有 android v7 appcompat 支持,而 Twilio 视频 SDK 使用最新的 v7 支持。

所以在将 AIR SDK 版本升级到最新版本(当前为 v.29)之后,我可以在我的布局中集成 twilio VideoView。