javaandroidexoplayer2.xcannot-find-symbol

Cannot find symbol `ResolvingDataSource` from com.google.android.exoplayer2.upstream.ResolvingDataSource


Title says it all. ExoPlayer should have this. Just look at this page: https://exoplayer.dev/doc/reference/com/google/android/exoplayer2/upstream/ResolvingDataSource.html

But when I import import com.google.android.exoplayer2.upstream.ResolvingDataSource at the top of my class it lights up with red underline. And when I try to do:

HlsMediaSource hlsMediaSource = new HlsMediaSource.Factory(
                new ResolvingDataSource.Factory(
                    new DefaultHttpDataSourceFactory(Util.getUserAgent(this,getString(R.string.app_name))),
                    // Provide just-in-time URI resolution logic.
                    (DataSpec dataSpec) -> dataSpec.withUri(resolveUri(dataSpec.uri))
                )
            ).createMediaSource(Uri.parse(link));

ReolvingDataSource lights up with red underline. I also have this in my app build.gradel: implementation 'com.google.android.exoplayer:exoplayer:2.9.1'

Can anyone help?


Solution

  • Please update the library to latest version 2.11.8:

    implementation 'com.google.android.exoplayer:exoplayer:2.11.8'
    

    Third party libraries always change, so keep track its official sites.