brianwernick/ExoMedia

ExoMedia demo crashes with v5.0.0 on Android 8.1 and Android 9 virtual devices

gtaman92 opened this issue · 1 comments

Environment:

  • ExoMedia version: 5.0.0
  • Device OS version: 8.1 / 9.0
  • Device Manufacturer: Google
  • Device Name: Nexus 7

Reproduction Steps

Compile and launch the exomedia demo, or utilise the exomedia library in any application.

Expected Result

VideoView displays (com.devbrackets.android.exomedia.ui.widget.VideoView)

Actual Result

Crash with the error: Binary XML file line #12: Error inflating class com.devbrackets.android.exomedia.ui.widget.VideoView

2023-07-04 15:49:32.586 5699-5699 AndroidRuntime com...brackets.android.exomediademo E FATAL EXCEPTION: main Process: com.devbrackets.android.exomediademo, PID: 5699 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.devbrackets.android.exomediademo/com.devbrackets.android.exomediademo.ui.media.VideoPlayerActivity}: android.view.InflateException: Binary XML file line #12: Binary XML file line #12: Error inflating class com.devbrackets.android.exomedia.ui.widget.VideoView at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2913) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:193) at android.app.ActivityThread.main(ActivityThread.java:6669) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858) Caused by: android.view.InflateException: Binary XML file line #12: Binary XML file line #12: Error inflating class com.devbrackets.android.exomedia.ui.widget.VideoView Caused by: android.view.InflateException: Binary XML file line #12: Error inflating class com.devbrackets.android.exomedia.ui.widget.VideoView 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:647) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730) at android.view.LayoutInflater.rInflate(LayoutInflater.java:863) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824) at android.view.LayoutInflater.inflate(LayoutInflater.java:515) at android.view.LayoutInflater.inflate(LayoutInflater.java:423) at com.devbrackets.android.exomediademo.databinding.VideoPlayerActivityBinding.inflate(VideoPlayerActivityBinding.java:56) at com.devbrackets.android.exomediademo.databinding.VideoPlayerActivityBinding.inflate(VideoPlayerActivityBinding.java:50) at com.devbrackets.android.exomediademo.ui.media.VideoPlayerActivity.inflateBinding(VideoPlayerActivity.kt:61) at com.devbrackets.android.exomediademo.ui.media.VideoPlayerActivity.inflateBinding(VideoPlayerActivity.kt:29) at com.devbrackets.android.exomediademo.ui.support.BindingActivity.onCreate(BindingActivity.kt:25) at com.devbrackets.android.exomediademo.ui.media.VideoPlayerActivity.onCreate(VideoPlayerActivity.kt:65) at android.app.Activity.performCreate(Activity.java:7136) at android.app.Activity.performCreate(Activity.java:7127) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2893) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:193) at android.app.ActivityThread.main(ActivityThread.java:6669) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) 2023-07-04 15:49:32.586 5699-5699 AndroidRuntime com...brackets.android.exomediademo E at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858) Caused by: android.view.InflateException: Binary XML file line #24: Binary XML file line #24: Error inflating class ImageButton Caused by: android.view.InflateException: Binary XML file line #24: Error inflating class ImageButton Caused by: android.content.res.Resources$NotFoundException: Drawable com.devbrackets.android.exomediademo:color/exomedia_controls_button_background with resource ID #0x7f060037 Caused by: android.content.res.Resources$NotFoundException: File res/color/exomedia_controls_button_background.xml from drawable resource ID #0x7f060037 at android.content.res.ResourcesImpl.loadDrawableForCookie(ResourcesImpl.java:847) at android.content.res.ResourcesImpl.loadDrawable(ResourcesImpl.java:631) at android.content.res.Resources.loadDrawable(Resources.java:897) at android.content.res.TypedArray.getDrawableForDensity(TypedArray.java:955) at android.content.res.TypedArray.getDrawable(TypedArray.java:930) at android.view.View.<init>(View.java:5010) at android.widget.ImageView.<init>(ImageView.java:177) at android.widget.ImageButton.<init>(ImageButton.java:86) at android.widget.ImageButton.<init>(ImageButton.java:82) at androidx.appcompat.widget.AppCompatImageButton.<init>(AppCompatImageButton.java:78) at androidx.appcompat.widget.AppCompatImageButton.<init>(AppCompatImageButton.java:73) at androidx.appcompat.app.AppCompatViewInflater.createImageButton(AppCompatViewInflater.java:253) at androidx.appcompat.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:168) at androidx.appcompat.app.AppCompatDelegateImpl.createView(AppCompatDelegateImpl.java:1678) at androidx.appcompat.app.AppCompatDelegateImpl.onCreateView(AppCompatDelegateImpl.java:1729) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:772) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730) at android.view.LayoutInflater.rInflate(LayoutInflater.java:863) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824) 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 android.view.View.inflate(View.java:24354) at com.devbrackets.android.exomedia.ui.widget.controls.DefaultVideoControls.setup(DefaultVideoControls.kt:667) at com.devbrackets.android.exomedia.ui.widget.controls.VideoControlsMobile.setup(VideoControlsMobile.kt:46) at com.devbrackets.android.exomedia.ui.widget.controls.DefaultVideoControls.<init>(DefaultVideoControls.kt:112) at com.devbrackets.android.exomedia.ui.widget.controls.VideoControlsMobile.<init>(VideoControlsMobile.kt:40) at com.devbrackets.android.exomedia.ui.widget.controls.VideoControlsProvider.getControls(VideoControlsProvider.kt:13) at com.devbrackets.android.exomedia.ui.widget.VideoView.postInit(VideoView.kt:842) at com.devbrackets.android.exomedia.ui.widget.VideoView.setup(VideoView.kt:808) at com.devbrackets.android.exomedia.ui.widget.VideoView.<init>(VideoView.kt:259) at java.lang.reflect.Constructor.newInstance0(Native Method) at java.lang.reflect.Constructor.newInstance(Constructor.java:343) at android.view.LayoutInflater.createView(LayoutInflater.java:647) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730) at android.view.LayoutInflater.rInflate(LayoutInflater.java:863) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824) at android.view.LayoutInflater.inflate(LayoutInflater.java:515) at android.view.LayoutInflater.inflate(LayoutInflater.java:423) at com.devbrackets.android.exomediademo.databinding.VideoPlayerActivityBinding.inflate(VideoPlayerActivityBinding.java:56) at com.devbrackets.android.exomediademo.databinding.VideoPlayerActivityBinding.inflate(VideoPlayerActivityBinding.java:50) 2023-07-04 15:49:32.588 5699-5699 AndroidRuntime com...brackets.android.exomediademo E at com.devbrackets.android.exomediademo.ui.media.VideoPlayerActivity.inflateBinding(VideoPlayerActivity.kt:61) at com.devbrackets.android.exomediademo.ui.media.VideoPlayerActivity.inflateBinding(VideoPlayerActivity.kt:29) at com.devbrackets.android.exomediademo.ui.support.BindingActivity.onCreate(BindingActivity.kt:25) at com.devbrackets.android.exomediademo.ui.media.VideoPlayerActivity.onCreate(VideoPlayerActivity.kt:65) at android.app.Activity.performCreate(Activity.java:7136) at android.app.Activity.performCreate(Activity.java:7127) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2893) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:193) at android.app.ActivityThread.main(ActivityThread.java:6669) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858) Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #3: <item> tag requires a 'drawable' attribute or child tag defining a drawable at android.graphics.drawable.StateListDrawable.inflateChildElements(StateListDrawable.java:190) at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:122) at android.graphics.drawable.DrawableInflater.inflateFromXmlForDensity(DrawableInflater.java:142) at android.graphics.drawable.Drawable.createFromXmlInnerForDensity(Drawable.java:1332) at android.graphics.drawable.Drawable.createFromXmlForDensity(Drawable.java:1291) at android.content.res.ResourcesImpl.loadDrawableForCookie(ResourcesImpl.java:833) ... 60 more

This appears to be due to using a color selector for the background resource; when using selectors they should provide a drawables instead of colors so we'll need to just update the exomedia_controls_button_background to be a drawable (and provide drawables) which will resolve the issue on pre-API 29.