Reputation: 1319
I am trying to create a simple video player android app with exoplayer.
I found a couple of examples like:
https://github.com/brianwernick/ExoMedia/?
https://github.com/ayalus/ExoPlayer-2-Example?
https://github.com/google/ExoPlayer?
However when I try to build and run the projects, I keep getting the same error:
Failed to resolve: com.google.android.exoplayer:exoplayer- smoothstreaming:2.9.1 Install Repository and sync project
Open File Show in Project Structure dialog
I am using the latest version of the android studio and when click on "Install Repository and sync project" It gives the following error message:
"Could not find dependency "com.google.android.exoplayer:exoplayer-smoothstreaming:2.9.1""
I don't know how to solve the problem. If you can share a simple player example that can also work for me.
Upvotes: 3
Views: 10546
Reputation: 1876
With Google sunsetting jcenter
in 2022, exoplayer
now has to install exclusively from Google Maven, aka google
, which is also the recommended way to install according to their Github page.
It appears however some older versions of exoplayer
, e.g. v2.9.x
, only exists on jcenter
. This could be a problem if your app is migrating away from jcenter
as Google recommended. The problem would easily go away if you install exoplayer
's latest version, v15
.
My suggestion is if you are already considering deprecating the old jcenter
, you might as well update exoplayer
to its latest version.
Upvotes: 2
Reputation: 116
the exoplayer dependency should now be available on jcenter(). Please let us know if you still run into any issues. https://issuetracker.google.com/issues/120759347#comment97.
Upvotes: 1
Reputation: 2149
I think that you missed type for your dependency :
<dependency>
<groupId>com.google.android.exoplayer</groupId>
<artifactId>exoplayer-smoothstreaming</artifactId>
<version>2.9.1</version>
<type>pom</type>
</dependency>
You should also add a repo that contain this artifact (maven.google.com for example) to your repositories in order to fetch it.
<repositories>
<repository>
<id>android-studio</id>
<url>https://maven.google.com</url>
</repository>
</repositories>
for gradle refer to https://github.com/google/ExoPlayer
Upvotes: 0
Reputation: 1319
Changing the gradle file as follows solved the problem
allprojects {
repositories {
maven { url 'https://google.bintray.com/exoplayer/' }
maven { url 'https://dl.bintray.com/android/android-tools' }
maven { url 'https://dl.bintray.com/firebase/gradle/' }
google()
jcenter()
mavenCentral()
maven { url "https://jitpack.io" }
flatDir {
dirs 'libs'
}
}
}
Upvotes: 0