Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

After updating Gradle dependencies failed to resolve

Tags:

android

gradle

After update gradle to latest dependencies contain firebase and play services:

Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.

It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

Failed to resolve: play-services-base Open File

Failed to resolve: play-services-tasks Open File

Failed to resolve: play-services-stats Open File

Failed to resolve: play-services-ads-identifier Open File

Failed to resolve: play-services-basement Open File

build.gradle(app)

implementation 'com.google.firebase:firebase-messaging:17.0.0'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.android.gms:play-services-analytics:16.0.0'
implementation 'com.google.android.gms:play-services-maps:15.0.1'
implementation 'com.google.android.gms:play-services-auth:15.0.1'
implementation 'com.google.android.gms:play-services-places:15.0.1'

How can I resolve?

like image 828
Long Bui Duc Avatar asked Jun 12 '18 08:06

Long Bui Duc


People also ask

How do I resolve Gradle dependencies?

Given a required dependency, with a version, Gradle attempts to resolve the dependency by searching for the module the dependency points at. Each repository is inspected in order. Depending on the type of repository, Gradle looks for metadata files describing the module ( .

Can't resolve all files for configuration Gradle?

This is because of slow internet connection or you haven't configure proxy settings correctly. Gradle needs to download some dependencies , if it cant access the repository it fires this error. All you have to do is check your internet connection and make sure gradle can access the maven repository. Save this answer.


2 Answers

I resolved issue. This is solution

1.add google() before jcenter()
2.exclude group:"com.google.android.gms" in facebook sdk dependencies

My code Gradle :

buildscript {
repositories {
    google()
    jcenter()
}

// something here ...

dependencies {
    classpath 'com.android.tools.build:gradle:3.1.3'
    classpath "io.realm:realm-gradle-plugin:3.1.1"
    classpath 'com.google.gms:google-services:4.0.1'
}
}

allprojects {
repositories {
    google()
    jcenter()
}
}

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

And Myapp/gradle :

repositories {
   maven { url 'https://maven.fabric.io/public' }
   google()
   jcenter()
}

dependencies {
implementation('com.crashlytics.sdk.android:crashlytics:2.8.0@aar') {
    transitive = true
}

implementation ('com.facebook.android:account-kit-sdk:4.28.0'){
    exclude group:"com.google.android.gms"
}
implementation 'com.facebook.android:facebook-android-sdk:4.32.0'

implementation 'com.googlecode.libphonenumber:libphonenumber:8.9.4'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.4.2'
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'

implementation 'com.android.support:multidex:1.0.3'
implementation files('libs/glide-3.8.0.jar')
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation('com.squareup.okhttp:okhttp-urlconnection:2.3.0') {
    exclude group: 'com.squareup.okhttp', module: 'okhttp'
}
implementation('com.squareup.okhttp:okhttp:2.3.0') {
    exclude group: 'com.squareup.okio', module: 'okio'
}
implementation 'me.relex:circleindicator:1.2.2@aar'
implementation 'com.android.support:exifinterface:27.1.1'

implementation 'com.google.firebase:firebase-messaging:17.0.0'
implementation 'com.google.firebase:firebase-database:16.0.1'

implementation 'com.google.android.gms:play-services-analytics:16.0.0'
implementation 'com.google.android.gms:play-services-maps:15.0.1'
implementation 'com.google.android.gms:play-services-auth:15.0.1'
implementation 'com.google.android.gms:play-services-places:15.0.1'

}
apply plugin: 'com.google.gms.google-services'
like image 64
Long Bui Duc Avatar answered Oct 20 '22 16:10

Long Bui Duc


I have the same problem and resolved by this:

In Gradle (project), just change the position of google() before jcenter(), and Sync and the error is gone.

repositories {
    google()
    jcenter()
}
like image 4
Subhash Gaikwad Avatar answered Oct 20 '22 18:10

Subhash Gaikwad