I rebuild an existing project in Android Studio and the following error occurs
1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:dataBindingMergeDependencyArtifactsDebug'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Could not find com.google.android.exoplayer:exoplayer:2.11.4.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/google/android/exoplayer/exoplayer/2.11.4/exoplayer-2.11.4.pom
- https://jcenter.bintray.com/com/google/android/exoplayer/exoplayer/2.11.4/exoplayer-2.11.4.pom
- https://repo.maven.apache.org/maven2/com/google/android/exoplayer/exoplayer/2.11.4/exoplayer-2.11.4.pom
- https://jitpack.io/com/google/android/exoplayer/exoplayer/2.11.4/exoplayer-2.11.4.pom
Required by:
project :app > com.github.HamidrezaAmz:MagicalExoPlayer:1.0.16
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
==============================================================================
I did the followings but it didn’t solve the problem:
- added this to build.gradle :
allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}
- Also added this to build.gradle according to this:
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'
}
}
}
2
Answers
Legacy versions of ExoPlayer were hosted on a discontinued Maven repository.
2.11.4
, from April 2020, is one of those versions.The simplest solution is to upgrade to
2.13.0
or higher, as those versions are hosted on Google’s own Maven repository (google()
). Most likely that will require upgrading to a newer version ofcom.github.HamidrezaAmz:MagicalExoPlayer
, as1.0.16
is also very old.The error you’re encountering is happening because the version of ExoPlayer you’re trying to use (2.11.4) is hosted on a Maven repository that has been discontinued. This means that Gradle can no longer find that version in the repositories where it used to be available.
Versions of ExoPlayer before 2.13.0 were hosted on an old repository that no longer exists. So the simplest solution is to update to a newer version of ExoPlayer, such as 2.13.0 or later, since these versions are now hosted in Google’s repository (google()). Not only will this resolve the dependency issue, but you’ll also benefit from improvements and bug fixes that have been made since those earlier versions.
In your project, I also noticed you’re using MagicalExoPlayer (version 1.0.16), which is quite outdated. It’s possible that this library might not be compatible with the latest versions of ExoPlayer. Here’s what I recommend
Update ExoPlayer to a more recent version: For instance, you could try using version 2.18.5 of ExoPlayer. You can do this by updating your build.gradle file like this:
Update MagicalExoPlayer or consider alternatives: If you encounter compatibility issues after updating ExoPlayer, I suggest looking for a newer version of MagicalExoPlayer. If there’s no updated version available, you might want to explore other alternatives that work better with the current versions of ExoPlayer, or even consider implementing some of the needed functionality directly using ExoPlayer’s APIs.
Finally, make sure that your build.gradle file is set up with the correct repositories. It should look something like this:
With these changes, you should be able to resolve the dependencies without any issues.