'> Could not find com.google.android.exoplayer:exoplayer-core:r2.4.2

I am facing this exoplayer not found error in video android studio application after I updated my project dependencies.

I don't know how to update old Exoplayer link to https://mvnrepository.com/artifact/com.google.android.exoplayer/exoplayer

Can anyone tell how to remove this error and update to latest exoplayer version ?

build.gradle file:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        google()
        mavenCentral()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:7.0.2'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()

    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

ERROR:

FAILURE: Build completed with 7 failures.

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Could not find com.google.android.exoplayer:exoplayer-core:r2.4.2.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/google/android/exoplayer/exoplayer-core/r2.4.2/exoplayer-core-r2.4.2.pom
       - https://repo.maven.apache.org/maven2/com/google/android/exoplayer/exoplayer-core/r2.4.2/exoplayer-core-r2.4.2.pom
     Required by:
         project :app > com.facebook.android:audience-network-sdk:5.2.0
   > Could not find com.google.android.exoplayer:exoplayer-dash:r2.4.2.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/google/android/exoplayer/exoplayer-dash/r2.4.2/exoplayer-dash-r2.4.2.pom
       - https://repo.maven.apache.org/maven2/com/google/android/exoplayer/exoplayer-dash/r2.4.2/exoplayer-dash-r2.4.2.pom
     Required by:
         project :app > com.facebook.android:audience-network-sdk:5.2.0

* 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.
==============================================================================

2: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Could not find com.google.android.exoplayer:exoplayer-core:r2.4.2.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/google/android/exoplayer/exoplayer-core/r2.4.2/exoplayer-core-r2.4.2.pom
       - https://repo.maven.apache.org/maven2/com/google/android/exoplayer/exoplayer-core/r2.4.2/exoplayer-core-r2.4.2.pom
     Required by:
         project :app > com.facebook.android:audience-network-sdk:5.2.0
   > Could not find com.google.android.exoplayer:exoplayer-dash:r2.4.2.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/google/android/exoplayer/exoplayer-dash/r2.4.2/exoplayer-dash-r2.4.2.pom
       - https://repo.maven.apache.org/maven2/com/google/android/exoplayer/exoplayer-dash/r2.4.2/exoplayer-dash-r2.4.2.pom
     Required by:
         project :app > com.facebook.android:audience-network-sdk:5.2.0

* 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.
==============================================================================

3: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:processDebugMainManifest'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Could not find com.google.android.exoplayer:exoplayer-core:r2.4.2.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/google/android/exoplayer/exoplayer-core/r2.4.2/exoplayer-core-r2.4.2.pom
       - https://repo.maven.apache.org/maven2/com/google/android/exoplayer/exoplayer-core/r2.4.2/exoplayer-core-r2.4.2.pom
     Required by:
         project :app > com.facebook.android:audience-network-sdk:5.2.0
   > Could not find com.google.android.exoplayer:exoplayer-dash:r2.4.2.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/google/android/exoplayer/exoplayer-dash/r2.4.2/exoplayer-dash-r2.4.2.pom
       - https://repo.maven.apache.org/maven2/com/google/android/exoplayer/exoplayer-dash/r2.4.2/exoplayer-dash-r2.4.2.pom
     Required by:
         project :app > com.facebook.android:audience-network-sdk:5.2.0

* 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.
==============================================================================

4: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:mergeDebugAssets'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Could not find com.google.android.exoplayer:exoplayer-core:r2.4.2.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/google/android/exoplayer/exoplayer-core/r2.4.2/exoplayer-core-r2.4.2.pom
       - https://repo.maven.apache.org/maven2/com/google/android/exoplayer/exoplayer-core/r2.4.2/exoplayer-core-r2.4.2.pom
     Required by:
         project :app > com.facebook.android:audience-network-sdk:5.2.0
   > Could not find com.google.android.exoplayer:exoplayer-dash:r2.4.2.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/google/android/exoplayer/exoplayer-dash/r2.4.2/exoplayer-dash-r2.4.2.pom
       - https://repo.maven.apache.org/maven2/com/google/android/exoplayer/exoplayer-dash/r2.4.2/exoplayer-dash-r2.4.2.pom
     Required by:
         project :app > com.facebook.android:audience-network-sdk:5.2.0

* 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.
==============================================================================

5: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:checkDebugDuplicateClasses'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Could not find com.google.android.exoplayer:exoplayer-core:r2.4.2.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/google/android/exoplayer/exoplayer-core/r2.4.2/exoplayer-core-r2.4.2.pom
       - https://repo.maven.apache.org/maven2/com/google/android/exoplayer/exoplayer-core/r2.4.2/exoplayer-core-r2.4.2.pom
     Required by:
         project :app > com.facebook.android:audience-network-sdk:5.2.0
   > Could not find com.google.android.exoplayer:exoplayer-dash:r2.4.2.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/google/android/exoplayer/exoplayer-dash/r2.4.2/exoplayer-dash-r2.4.2.pom
       - https://repo.maven.apache.org/maven2/com/google/android/exoplayer/exoplayer-dash/r2.4.2/exoplayer-dash-r2.4.2.pom
     Required by:
         project :app > com.facebook.android:audience-network-sdk:5.2.0

* 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.
==============================================================================

6: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:mergeDebugJavaResource'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Could not find com.google.android.exoplayer:exoplayer-core:r2.4.2.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/google/android/exoplayer/exoplayer-core/r2.4.2/exoplayer-core-r2.4.2.pom
       - https://repo.maven.apache.org/maven2/com/google/android/exoplayer/exoplayer-core/r2.4.2/exoplayer-core-r2.4.2.pom
     Required by:
         project :app > com.facebook.android:audience-network-sdk:5.2.0
   > Could not find com.google.android.exoplayer:exoplayer-dash:r2.4.2.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/google/android/exoplayer/exoplayer-dash/r2.4.2/exoplayer-dash-r2.4.2.pom
       - https://repo.maven.apache.org/maven2/com/google/android/exoplayer/exoplayer-dash/r2.4.2/exoplayer-dash-r2.4.2.pom
     Required by:
         project :app > com.facebook.android:audience-network-sdk:5.2.0

* 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.
==============================================================================

7: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:mergeDebugNativeLibs'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Could not find com.google.android.exoplayer:exoplayer-core:r2.4.2.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/google/android/exoplayer/exoplayer-core/r2.4.2/exoplayer-core-r2.4.2.pom
       - https://repo.maven.apache.org/maven2/com/google/android/exoplayer/exoplayer-core/r2.4.2/exoplayer-core-r2.4.2.pom
     Required by:
         project :app > com.facebook.android:audience-network-sdk:5.2.0
   > Could not find com.google.android.exoplayer:exoplayer-dash:r2.4.2.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/google/android/exoplayer/exoplayer-dash/r2.4.2/exoplayer-dash-r2.4.2.pom
       - https://repo.maven.apache.org/maven2/com/google/android/exoplayer/exoplayer-dash/r2.4.2/exoplayer-dash-r2.4.2.pom
     Required by:
         project :app > com.facebook.android:audience-network-sdk:5.2.0

* 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.
==============================================================================

* Get more help at https://help.gradle.org

BUILD FAILED in 4s
20 actionable tasks: 19 executed, 1 up-to-date


Solution 1:[1]

Worked after adding these to build.gradle:

implementation 'com.google.android.exoplayer:exoplayer-core:2.15.1'
implementation 'com.google.android.exoplayer:exoplayer-dash:2.15.1'
implementation 'com.google.android.exoplayer:exoplayer-ui:2.15.1'

And enabling multidex.

Check this out https://exoplayer.dev/hello-world.html

Solution 2:[2]

Exoplayer library version 2.4.2 isn't found on Google's Maven Repo anymore. Change the implementation to this

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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ayush Kadbe
Solution 2