1

I have an Android project that uses version 3 of JWPlayer which in turn uses Exoplayer. The problem is that now we get a message saying that JCenter() has been deprecate and makes it incompatible with Gradle 8.0. When we remove JCenter() and build, we now get the following errors:

Failed to resolve: com.google.android.exoplayer:exoplayer-core:2.10.6
Failed to resolve: com.google.android.exoplayer:exoplayer-dash:2.10.6
Failed to resolve: com.google.android.exoplayer:exoplayer-hls:2.10.6
Failed to resolve: com.google.android.exoplayer:exoplayer-smoothstreaming:2.10.6
Failed to resolve: com.google.android.exoplayer:exoplayer-ui:2.10.6

We got a similar error for Volley but updating the version number took care of the problem. However, we updated the exoplayer version to 2.11 and it didn't help.

How can we implement all of these exoplayer dependencies?

Update: I have read that I can point to the mavenCentral or the google repositories but I am doing that and I still get the error.

Build gradle (project):

buildscript {
repositories {
    google()
    mavenCentral()
    gradlePluginPortal()

}
dependencies {
    classpath 'com.android.tools.build:gradle:7.2.1'
    classpath 'com.google.gms:google-services:4.3.10'
    classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.10, 0.99.99]'

    def nav_version = '2.4.1'
    classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version"

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

allprojects {
repositories {
    google()
    mavenCentral()

    maven {
        url 'https://mvn.jwplayer.com/content/repositories/releases/'
    }
    maven {
        url 'https://jitpack.io'
    }
}
}

Build gradle (app)

buildscript {
        repositories {
            google()
            maven { url 'https://plugins.gradle.org/m2/' }
        }
    }
    
    plugins {
        id 'com.onesignal.androidsdk.onesignal-gradle-plugin'
        id 'com.android.application'
    }
    
    repositories {
        maven { url 'https://maven.google.com' }
        maven { url 'https://zendesk.jfrog.io/zendesk/repo' }
        maven { url 'https://swisscodemonkeys.github.io/appbrain-sdk/maven' }
        google()
        mavenCentral()
    }
    
    android {
        compileSdkVersion 31
        buildToolsVersion "30.0.3"
    
        defaultConfig {
            applicationId "com.xxxxx.xxxxxxxx"
            minSdkVersion 21
            multiDexEnabled true
            targetSdkVersion 31
            versionCode 15
            versionName "5.0.2"
    
    
            testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        }
    
        compileOptions {
            sourceCompatibility = '1.8'
            targetCompatibility = '1.8'
        }
    
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            }
        }
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_8
            targetCompatibility JavaVersion.VERSION_1_8
        }
    }
    
    
cesarcarlos
  • 1,271
  • 1
  • 13
  • 33
  • 1
    Did you not search and find: [JCenter deprecation; impact on Gradle and Android](https://stackoverflow.com/q/66651640/295004) or ["JCenter is at end of life" android lint warning, what is the replacement?](https://stackoverflow.com/q/66400264/295004) – Morrison Chang Jun 28 '22 at 18:09

1 Answers1

0

Quoting the ExoPlayer documentation:

ExoPlayer modules can be obtained from the Google Maven repository.

So, if you have google() in your repositories, you can get 2.13.0 and newer from there.

However, we updated the exoplayer version to 2.11 and it didn't help

That ranges from 2 to 2.5 years old, depending on which patch level you were trying. The now-current is 2.18.0.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • I tried 2.13.0 and it still didn't work. Then I tried 2.18.0 and this time the errors went away but I got Execution failed for task ':app:compileDebugJavaWithJavac'. > java.lang.ExceptionInInitializerError Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. – cesarcarlos Jun 28 '22 at 18:43
  • @cesarcarlos: "Some input files use or override a deprecated API" -- that complaint usually does not fail a build. If you cannot find existing support for that problem, you might want to file a separate Stack Overflow question, where your [mcve] shows the full build output. – CommonsWare Jun 28 '22 at 19:14