Could not find com.google.android.gms:strict-version-matcher-plugin:1.1.0

蓝咒 提交于 2019-12-03 13:13:25

I have had similar issue in Android Project on Android Studio.

Make sure that your project level build.gradle file is something 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 {
    google()
    jcenter()
}
task clean(type: Delete) {
delete rootProject.buildDir
}

Solved this issue by adding repositories with both jcenter() and google() in both repositories{} and allprojects{}

TL;DR This is a problem related to jcenter repository reporting it's not finding the lib your plugins relies on, a lot of people is experiencing this same issue, In order to get it working you need to put jcenter as the last option in your platforms/android/build.gradle file.

From this: platforms/android/build.gradle - Line 40

// Allow plugins to declare Maven dependencies via build-extras.gradle.
allprojects {
    repositories {
        jcenter()
        maven {
            url "https://maven.google.com"
        }
    }
}

To this: platforms/android/build.gradle - Line 40

// Allow plugins to declare Maven dependencies via build-extras.gradle.
allprojects {
    repositories {
        mavenLocal()
        google()
        maven {
            url "https://maven.google.com"
        }
        jcenter()
    }
}

Then try building your app again.

If you get error related to not finding the google() repostiory, try updating your gradle version.

I have same issue, caused by cordova-plugin-fcm.

Solved by add google maven to plugin's gradle. For cordova-plugin-fcm, it is here:

platforms > android > cordova-plugin-fcm > ***.gradle

You may check inside your cordova-plugin-googleplus folder or other plugin that have dependencies to google-services, mine look like this:

dependencies {
    ...
    classpath 'com.google.gms:google-services:+'
    ...
}

My final code:

buildscript {
    repositories {
        maven { url "https://maven.google.com" }
        jcenter()
        mavenLocal()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:+'
        classpath 'com.google.gms:google-services:+'
    }
}
// apply plugin: 'com.google.gms.google-services'
// class must be used instead of id(string) to be able to apply plugin from non-root gradle file
apply plugin: com.google.gms.googleservices.GoogleServicesPlugin
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!