Firebase gradle build使用最新的11.8.0版本获取错误

时间:2018-03-06 06:22:21

标签: android firebase android-gradle google-cloud-messaging firebase-cloud-messaging

Android studio gradle build使用Firebase API时出错。我使用了google doc中的所有参数。它正在使用示例应用程序。但是,如果我将相同的库添加到我的应用程序gradle build中,则显示此错误。

在构建gradle时,它在Android studio 3.0.1中会出现如下错误:

Error:Cause: inconsistent module metadata found. Descriptor: com.google.gms:google-services:3.2.0 Errors: bad group: expected='com.google.gms.' found='com.google.gms'

这里我要添加根gradle文件:

buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
        classpath 'me.tatarka:gradle-retrolambda:3.3.0-beta4'
        classpath 'com.google.gms.:google-services:3.2.0'

    }
}

allprojects {
    repositories {
        google()
        jcenter()

        mavenCentral()
        maven { url 'https://jitpack.io' }

        maven {
            url 'https://repo.adobe.com/nexus/content/repositories/releases/'
        }

        maven {
            url 'http://maven.localytics.com/public'
        }
        maven { url 'https://maven.google.com' }
    }
}

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

还有app gradle文件:

apply plugin: 'com.android.application'
apply plugin: 'me.tatarka.retrolambda'


android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "co.hushush.user"
        minSdkVersion 16
        targetSdkVersion 27
        versionCode 5
        versionName "1.4-Beta"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true
        multiDexEnabled true
        manifestPlaceholders = [appPackageName: "${applicationId}"]
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility org.gradle.api.JavaVersion.VERSION_1_8
        targetCompatibility org.gradle.api.JavaVersion.VERSION_1_8
    }
    packagingOptions {
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/rxjava.properties'
        pickFirst 'AndroidManifest.xml'

    }
    lintOptions {
        checkReleaseBuilds false
        abortOnError false
    }
    dexOptions {
        jumboMode true
    }
    buildToolsVersion '27.0.3'
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:27.1.0'
    implementation 'com.android.support:design:27.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.android.support:support-vector-drawable:27.1.0'
    implementation 'com.android.support:support-v4:27.1.0'
    compile 'com.google.firebase:firebase-messaging:11.8.0'
    compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
    compile 'io.reactivex.rxjava2:rxjava:2.1.0'
    compile 'com.squareup.retrofit2:retrofit:2.3.0'
    compile 'com.squareup.retrofit2:adapter-rxjava2:2.3.0'
    compile 'com.google.code.gson:gson:2.7'
    compile 'com.squareup.retrofit2:converter-gson:2.3.0'
    // For easy preference manager
    compile 'com.pixplicity.easyprefs:library:1.9.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
    implementation 'com.android.support:cardview-v7:27.1.0'
    implementation 'com.android.support:recyclerview-v7:27.1.0'
    implementation 'android.arch.persistence.room:runtime:1.0.0'
    annotationProcessor "android.arch.persistence.room:compiler:1.0.0"
    compile 'com.theartofdev.edmodo:android-image-cropper:2.6.0'
    compile 'com.adobe.creativesdk.foundation:auth:0.9.2006-5'
    compile 'com.adobe.creativesdk:image:4.8.4'
    compile 'com.localytics.android:library:3.8.0'
    compile 'com.android.support:multidex:1.0.1'
    compile 'de.hdodenhof:circleimageview:2.2.0'
    compile 'com.asksira.android:loopingviewpager:1.1.0'
    compile 'com.romandanylyk:pageindicatorview:1.0.0'
    compile 'com.github.bumptech.glide:glide:4.6.1'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.6.1'
    implementation 'com.facebook.android:facebook-android-sdk:[4,5)'
    compile 'com.paytm.pgsdk:pgsdk:1.0.6'
    compile 'com.squareup.okhttp3:okhttp:3.2.0'
    compile 'com.github.MdFarhanRaja:SearchableSpinner:1.9'
}

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

1 个答案:

答案 0 :(得分:3)

改变这个:

'com.google.gms.:google-services:3.2.0'

到此:

'com.google.gms:google-services:3.2.0'

point(.)

之前没有: