Nikhil
Nikhil

Reputation: 77

Gradle Project Sync Failing

My Project Sync is failing with the below errors -

Unable to resolve dependency for ':app@debug/compileClasspath': Could not download exoplayer-core.aar (com.google.android.exoplayer:exoplayer-core:r2.4.2)

Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not download exoplayer-core.aar (com.google.android.exoplayer:exoplayer-core:r2.4.2)

Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not download exoplayer-core.aar (com.google.android.exoplayer:exoplayer-core:r2.4.2)

Unable to resolve dependency for ':app@release/compileClasspath': Could not download exoplayer-core.aar (com.google.android.exoplayer:exoplayer-core:r2.4.2)

Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not download exoplayer-core.aar (com.google.android.exoplayer:exoplayer-core:r2.4.2)

My Project build.grade looks like this -

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

buildscript {
    repositories {
        jcenter()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
        classpath 'com.google.gms:google-services:4.2.0'

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

allprojects {
    repositories {
        jcenter()
        google()
        maven {
            url "https://maven.google.com"
        }
    }
}

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

And my App gradle file looks like -

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    buildToolsVersion '28.0.3'
    defaultConfig {
        applicationId "com.android.application"
        minSdkVersion 15
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.google.android.gms:play-services-ads:17.1.2'
    implementation 'com.google.android.gms:play-services-analytics:16.0.6'
    testImplementation 'junit:junit:4.12'
    implementation 'com.android.support:recyclerview-v7:28.0.0'
    implementation 'com.facebook.android:audience-network-sdk:5.1.0'
}

Any help in this regard would be appreciated!!! How do I resolve this??

I have tried Invalidate Caches/Restart option and also tried to rebuild the project but it didn't help..

Upvotes: 3

Views: 1663

Answers (3)

shadowsheep
shadowsheep

Reputation: 15022

So for sure if you didn't include exoplayer library in your build.gradle, your project won't synch.

UPDATE: Okay, sorry, now I got the problem you all using com.facebook.android:audience-network-sdk have experienced these days, and why in your build.gradle file there is not exoplayer dependency set.

Using com.facebook.android:audience-network-sdk that depends on exoplayer, if you didn't explicitly specify exoplayer-core and exoplayer-dash, gradle try to download the necessary dependency as for docs.

So, as @laylakn pointed out (upvoted for that) there where an issue between repository mirroring between bintray and jcenter.

So, specifically to your problem, since you have told me that you have tried adding the libraries and synch without success, that's because the version of exoplayer you are looking for (r2.4.2) is in the spring plugin repository.

spring plugin repo

So you should add it as your maven repo (because of the mirroring error of repositories stated before):

maven {
        url "https://repo.spring.io/plugins-release/"
      }

Or as explain on main GitHub repo, just pointing directly to bintray.

maven {
            url 'https://google.bintray.com/exoplayer/'
        }

and you should synch your project adding this two libraries:

implementation 'com.google.android.exoplayer:exoplayer:r2.4.2'
implementation 'com.google.android.exoplayer:exoplayer-smoothstreaming:r2.4.4'

enter image description here

So now I'm glad to here from you that the mirroring problem has been resolved and are you able to sync right now, without doing any changes to your build.gradle files.

I've left and updated my answer to better explain this situation.

Also some other famous repo take precautions: [-:

enter image description here

Upvotes: 0

Malek Hajmohammadi
Malek Hajmohammadi

Reputation: 1

By this Gradle configuration it works fine :

android {
compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}
compileSdkVersion 27
defaultConfig {
    ...
    targetSdkVersion 27
        ...
  }
}




ext {
    exoplayer_version = '2.9+'
}

dependencies {
    ...

//exoplayer

implementation ('com.google.android.exoplayer:exoplayer-core:' + exoplayer_version)
implementation ('com.google.android.exoplayer:exoplayer-dash:' + exoplayer_version)
implementation ('com.google.android.exoplayer:exoplayer-hls:' + exoplayer_version)
implementation ('com.google.android.exoplayer:exoplayer-smoothstreaming:' + exoplayer_version)
implementation ('com.google.android.exoplayer:exoplayer-ui:' + exoplayer_version)
implementation ('com.google.android.exoplayer:exoplayer:' + exoplayer_version)

Upvotes: 0

laylakn
laylakn

Reputation: 87

It seems that Exoplayer-core and Exoplayer-dash are broken since today
https://github.com/google/ExoPlayer/issues/5225

Upvotes: 1

Related Questions