Exoplayer: Error inflating class com.google.android.exoplayer2.ui.PlayerView

Created on 23 Nov 2018  Â·  9Comments  Â·  Source: google/ExoPlayer

hi,i have one issues;
R.layout.activity_play:
image

version 2.9.0

just null activity with setContentView(R.layout.activity_play);

why?

question

Most helpful comment

From 2.9.0, you need to add the following to the android section of the app's build.gradle file:

compileOptions {
  targetCompatibility JavaVersion.VERSION_1_8
}

as per the release notes and latest developer guide. Doing this resolves the issue (you probably need to sync and clean the project after adding this).

Aside: It's pretty unfortunate the failure mode is so obscure, but I don't think that's under our control.

All 9 comments

Process: com.example.exoplaytest, PID: 7050
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.exoplaytest/com.example.exoplaytest.PlayActivity}: android.view.InflateException: Binary XML file line #8: Binary XML file line #8: Error inflating class com.google.android.exoplayer2.ui.PlayerView
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2780)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.access$1300(ActivityThread.java:176)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: android.view.InflateException: Binary XML file line #8: Binary XML file line #8: Error inflating class com.google.android.exoplayer2.ui.PlayerView
Caused by: android.view.InflateException: Binary XML file line #8: Error inflating class com.google.android.exoplayer2.ui.PlayerView
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:334)
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 android.view.LayoutInflater.inflate(LayoutInflater.java:374)
at android.support.v7.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:469)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
at com.example.exoplaytest.PlayActivity.onCreate(PlayActivity.java:26)

It's hard to say what is causing this with the information you are providing. I wonder if there is any other exception stack trace in the logs.

Did you customize the layout file of the PlayerView in some ways?

Please provide complete information as requested in the issue template. The issue template can be found here.

If you customized the playerView or controller layout it would be useful to be able to look into these. In any case a bugreport taken just after the exception happened would allow us to check whether there are any other exceptions root causing the InflateException.

I got this issue too, today.
Attached sample:

ExoPlayerTest.zip

Any idea why this could happen?

Tested on Pixel 2 with Android P.
Attached bug report file.

bugreport-walleye-PQ1A.181205.002-2018-12-09-14-28-44.zip

When changing to version 2.8.4 of ExoPlayer (and changing the URL, as I got it wrong, to this: https://sample-videos.com/video123/mkv/720/big_buck_bunny_720p_1mb.mkv ) , it works fine.

Please fix this issue.

Attached the fixed version of the project:

ExoPlayerTest.zip

From 2.9.0, you need to add the following to the android section of the app's build.gradle file:

compileOptions {
  targetCompatibility JavaVersion.VERSION_1_8
}

as per the release notes and latest developer guide. Doing this resolves the issue (you probably need to sync and clean the project after adding this).

Aside: It's pretty unfortunate the failure mode is so obscure, but I don't think that's under our control.

@ojw28 Now it says it can't find the repository:

ERROR: Failed to resolve: com.google.android.exoplayer:exoplayer-core:2.9.0

See attached video and sample project.
ExoPlayerTest.zip
Uploading 2018-12-09_23-00-52.zip…

I tried to invalidate cache and rebuild. Didn't work.

@ojw28 So no solution for this?
Or will it get fixed by itself some day soon?

I got the same problem with this issue and that was fix by removing to layout
- exo_playback_control_view.xml
- exo_simple_player_view.xml

I implemented this layout to change control layout display and this issue solved by remove this layout from my project.

Was this page helpful?
0 / 5 - 0 ratings