• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

JWPlayer SDK crash

I'm trying to create a Cordova plugin which leverages the Android SDK of JWPlayer. Yes, I know there's a web player which can be used in Cordova, but it lacks a few features, most importantly Chromecast.

I'm struggling quite a bit because I don't have much experience with native development. In turn all the native developers I know aren't very experienced with Cordova and particularly plugin development. It's a different animal from regular applications. Advice like "put this into build.gradle" often don't work.

So far I managed to get the plugin itself to work, import the JWPlayer SDK and open a native activity over the Cordova application. But then it crashes. As logcat explains the reason:

```
2021-01-16 01:31:12.133 26962-26962/com.pixeldog.jwplayer E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.pixeldog.jwplayer, PID: 26962
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.pixeldog.jwplayer/com.pixeldog.jwplayer.JWPlayerActivity}: android.view.InflateException: Binary XML file line #13 in com.pixeldog.jwplayer:layout/main: Binary XML file line #13 in com.pixeldog.jwplayer:layout/main: Error inflating class com.longtailvideo.jwplayer.JWPlayerView
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3449)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3601)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
Caused by: android.view.InflateException: Binary XML file line #13 in com.pixeldog.jwplayer:layout/main: Binary XML file line #13 in com.pixeldog.jwplayer:layout/main: Error inflating class com.longtailvideo.jwplayer.JWPlayerView
Caused by: android.view.InflateException: Binary XML file line #13 in com.pixeldog.jwplayer:layout/main: Error inflating class com.longtailvideo.jwplayer.JWPlayerView
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
at android.view.LayoutInflater.createView(LayoutInflater.java:852)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1004)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:959)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:1121)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1082)
at android.view.LayoutInflater.inflate(LayoutInflater.java:680)
at android.view.LayoutInflater.inflate(LayoutInflater.java:532)
at android.view.LayoutInflater.inflate(LayoutInflater.java:479)
at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:455)
at android.app.Activity.setContentView(Activity.java:3468)
at com.pixeldog.jwplayer.JWPlayerActivity.onCreate(JWPlayerActivity.java:21)
at android.app.Activity.performCreate(Activity.java:8000)
at android.app.Activity.performCreate(Activity.java:7984)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1309)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3422)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3601)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/GoogleApiAvailabilityLight;
at com.longtailvideo.jwplayer.cast.e.a(SourceFile:16)
at com.longtailvideo.jwplayer.core.u.a(SourceFile:173)
at com.longtailvideo.jwplayer.JWPlayerView.a(SourceFile:360)
2021-01-16 01:31:12.133 26962-26962/com.pixeldog.jwplayer E/AndroidRuntime: at com.longtailvideo.jwplayer.JWPlayerView.<init>(SourceFile:253)
... 28 more
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.common.GoogleApiAvailabilityLight" on path: DexPathList[[zip file "/data/app/~~f07u-lJgkXR6nQaBq4TM3w==/com.pixeldog.jwplayer-C-Y_726nY9YvAYMRR-9h-g==/base.apk"],nativeLibraryDirectories=[/data/app/~~f07u-lJgkXR6nQaBq4TM3w==/com.pixeldog.jwplayer-C-Y_726nY9YvAYMRR-9h-g==/lib/arm64, /system/lib64, /system/product/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:207)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
... 32 more


If I'm reading this right, a class can't be inflated because it requires `com.google.android.gms.common.GoogleApiAvailabilityLight`.

What is this library? I checked the documentation and com.google.android.gms.common doesn't have it. It only has GoogleApiAvailability, but not GoogleApiAvailabilityLight.

How can I import this library? What might be missing?

I've been looking at JWPlayer's own demo app, but I can't find what's wrong in my plugin.
 
Back
Top Bottom