0

I'm using android studio 3.0.1. after adding firebase to one of my project. I got the famous error while syncing project gardle.

Failed to resolve: com.google.android.gms:play-services-maps:16.1.1 Failed to resolve: com.google.firebase:firebase-core:16.1.1 Failed to resolve: com.google.android.gms:play-services-location:16.1.1

and other lib related to firebase.after some search I realized that we should install google play service sdk and add google maven repositorie to my project gradle repositories.but I have already done that.

this is my project gradle code

    buildscript {

        repositories {
           google()
           jcenter()
           maven {
              url 'https://maven.fabric.io/public'
          }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
        classpath 'com.google.gms:google-services:4.0.1'
       }
    }

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

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

and this is my app module gradle

buildscript {
    repositories {
        maven { url 'https://plugins.gradle.org/m2/'}
    }
    dependencies {
        classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.8.1'
    }
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'

repositories {
    maven { url 'https://maven.google.com' }
}
apply plugin: 'com.android.application'


android {
    compileSdkVersion 27
    buildToolsVersion '27.0.3'

    defaultConfig {
        applicationId "com.app4charkh.user"
        minSdkVersion 17
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        manifestPlaceholders = [onesignal_app_id: "APP-ID", onesignal_google_project_number: "REMOTE"]

        resValue "string", "google_maps_key", (project.findProperty("GOOGLE_MAPS_API_KEY") ?: "GOOGLE_API")
//        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    repositories {
        jcenter()
        mavenCentral()
        google()
        maven { url "https://jitpack.io" }
    }

}

dependencies {


    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.matthew-tamlin:sliding-intro-screen:3.2.0'
//    compile 'com.android.support:appcompat-v7:26.1.0'
    compile 'com.android.support:design:27.1.1'
    compile 'com.google.android.gms:play-services-maps:15.0.1'
    compile 'com.android.support:cardview-v7:27.1.1'
    compile 'com.squareup.retrofit2:retrofit:2.3.0'
    compile 'com.squareup.retrofit2:converter-gson:2.3.0'
    compile 'com.squareup.okhttp3:okhttp:3.5.0'
    compile 'com.squareup.okhttp3:logging-interceptor:3.9.1'

    compile 'uk.co.chrisjenx:calligraphy:2.3.0'
    compile 'com.jakewharton:butterknife:8.8.1'
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'

    compile 'io.reactivex:rxandroid:1.2.0'
    compile 'io.reactivex:rxjava:1.1.4'
    compile 'com.squareup.retrofit2:adapter-rxjava:2.0.2'

    compile 'com.onesignal:OneSignal:[3.8.4, 3.99.99]'

    compile 'com.github.adityagohad:HorizontalPicker:1.0.1'
    compile 'com.ramotion.circlemenu:circle-menu:0.3.0'
    compile 'com.github.lukedeighton:wheelview:0.4.1'

//    compile 'com.journeyapps:zxing-android-embedded:3.5.0'

    compile 'com.nineoldandroids:library:2.4.0'
    compile 'com.daimajia.easing:library:1.0.1@aar'
    compile 'com.daimajia.androidanimations:library:1.1.3@aar'
    compile 'com.github.florent37:arclayout:1.0.3'
    compile 'com.flaviofaria:kenburnsview:1.0.7'

    compile 'org.parceler:parceler-api:1.1.9'
    annotationProcessor 'org.parceler:parceler:1.1.9'

    implementation 'com.github.bumptech.glide:glide:4.5.0'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.5.0'

    compile 'org.greenrobot:eventbus:3.1.1'
    compile 'me.zhanghai.android.materialratingbar:library:1.2.0'

    compile 'com.mohamadamin:persianmaterialdatetimepicker:1.2.1'
    implementation 'de.hdodenhof:circleimageview:2.2.0'

    compile 'com.github.markomilos:paginate:0.5.1'
    implementation 'com.google.firebase:firebase-core:16.0.1'
}
apply plugin: 'com.google.gms.google-services'
Mahdi Yusefi
  • 441
  • 4
  • 13
  • Possible duplicate of [Highest firebase version code is used for compiling play services library too](https://stackoverflow.com/questions/50512955/highest-firebase-version-code-is-used-for-compiling-play-services-library-too) – zfromg Jul 03 '18 at 13:38
  • @Mahdi Yusefi I think this is a compatibility problem because firebase core has a higher version than the other firebase dependencies. I recently had this problem and did not find anything to fix it. What I did was downgrade the version of firebase core to 15.0.1 and the error disappeared. – Quimbo Jul 18 '18 at 18:08

0 Answers0