简体   繁体   中英

Android - Implement exoplayer without JCenter

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
        }
    }
    
    

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM