androidapache-flexairtwilioane

Error inflating class com.twilio.video.VideoView


I am currently integrating Twilio Video with my AIR application. When I try Twilio VideoView in my activity layout, its giving error "Error inflating class com.twilio.video.VideoView"

Here is my layout

<?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>

I decompiled the jar file which is used to generate the ane extension file to check if Twilio video package is included or not. Twilio video packages are included in the jar file generated.

Here is the error I got

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.access$900(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.access$900(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.access$900(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.access$900(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

Any Idea how this can be solved. Found some answers on error type but non of these helped me out


Solution

  • Previously I was using AIR SDK version 16, old SDK versions doesn't have android v7 appcompat support while Twilio video SDK uses latest v7 support.

    So after upgrading AIR SDK version to latest(currently v.29), I can integrate twilio VideoView in my layout.