Android Studio Error The library com.google.androi

2019-02-26 04:56发布

问题:

How to this i am new on Android Studio.

The library com.google.android.gms:play-services-measurement-base is being requested by various other libraries at [[15.0.0,15.0.0], [15.0.2,15.0.2]], but resolves to 15.0.2. Disable the plugin and check your dependencies tree using ./gradlew :app:dependencies.

回答1:

As reported here:

You will need to update the version of the latter dependency to 15.0.2. This addresses the issue where version 3.3.0 of the Google Services Gradle plugin reports: The library com.google.android.gms:play-services-measurement-base is being requested by various other libraries at [[15.0.0,15.0.0], [15.0.2,15.0.2]], but resolves to 15.0.2...

Then update your google play services plugin to 3.3.0

classpath 'com.google.gms:google-services:3.3.0'

and update the dependencies to 15.0.2.



回答2:

Resolve this issue with me - If You are choosing Firestore Database then do this: first We will add updated these things in Gradle :

buildscript {
    // ...
    dependencies {
        // ...
        classpath 'com.google.gms:google-services:4.0.1' // google-services plugin
    }
}

allprojects {
    // ...
    repositories {
        // ...
        maven {
            url "https://maven.google.com" // Google's Maven repository
        }
    }
}

after this update :

apply plugin: 'com.android.application'

android {
  // ...
}

dependencies {
  // ...
  implementation 'com.google.firebase:firebase-core:16.0.0'

  // Getting a "Could not find" error? Make sure you have
  // added the Google maven respository to your root build.gradle
}

// ADD THIS AT THE BOTTOM
apply plugin: 'com.google.gms.google-services'

Then Rebuild or Sunc Now , issue will be resolve.

if You are working on RealTime Database then do this thing :-

Set Dependency :

implementation 'com.google.firebase:firebase-database:15.0.0'

and remove above FireStore Dependency.

This will sure resolve your issue ... If you like then vote for me



回答3:

buildscript {
    // ...
    dependencies {
        // ...
        classpath 'com.google.gms:google-services:4.0.1' // google-services plugin
    }
}

This works for me. By adding the latest version, i.e 4.0.1