Gradle同步失败:找不到ID为'com.google.android.gms:play-services'的插件 [英] Gradle sync failed: Plugin with id 'com.google.android.gms:play-services' not found

查看:108
本文介绍了Gradle同步失败:找不到ID为'com.google.android.gms:play-services'的插件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的一个项目中,我需要使用 GoogleMaps Firebase 来进行通知,但是该服务的库和

In one of my projects I need to use GoogleMaps and Firebase for notifications but the libraries of the service and the Firebase in place do not want to work.

buildscript {
    repositories {
        google()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    }
    dependencies {
        classpath 'com.google.android.gms:play-services:8.4.0'
        classpath 'com.android.tools.build:gradle:3.0.1'
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.+'
    }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

repositories {
    maven { url 'https://maven.fabric.io/public' }
    maven { url "https://maven.google.com" }
}

android {
    compileSdkVersion 26
    buildToolsVersion '26.0.2'
    defaultConfig {
        applicationId "com.online.app"
        minSdkVersion 16
        targetSdkVersion 25
        versionCode 8
        versionName "2.5"
        multiDexEnabled true
    }
    buildTypes {
        release {
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }    
    productFlavors {
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:support-v4:26.0.2'
    compile 'me.leolin:ShortcutBadger:1.1.6@aar'
    compile('com.crashlytics.sdk.android:crashlytics:2.6.0@aar') {
        transitive = true;
    }
    compile "com.google.firebase:firebase-ads:11.8.0"
    compile "com.android.support:appcompat-v7:26.1.0"
    compile 'com.android.support:multidex:1.0.1'
}

apply plugin: 'com.google.android.gms:play-services'

错误:

Gradle sync failed: Plugin with id 'com.google.android.gms:play-services' not found.
Consult IDE log for more details (Help | Show Log) (2s 325ms)


推荐答案

更改此项:

 apply plugin: 'com.google.android.gms:play-services'

为此:

apply plugin: 'com.google.gms.google-services'

检查此内容以获取更多信息: https://developers.google.com/android/ guides / google-services-plugin

check this for more info: https://developers.google.com/android/guides/google-services-plugin

这篇关于Gradle同步失败:找不到ID为'com.google.android.gms:play-services'的插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆