错误:找不到com.google.gms.google-services:4.2.0

问题描述 投票:4回答:2

我正在尝试将Firebase crashlytics添加到现有项目(不是由我开发)。我一直在收到错误

ERROR: Could not find com.google.gms.google-services:4.2.0:.
Required by:
    project :
Search in build.gradle files

我已经完成了要求添加maven {url'https://maven.google.com'}的所有(或大多数)解决方案,但没有一个能够正常工作。我收到了所有解决方案的上述错误。

请不要我开发的其他项目使用相同的build.gradle工作正常,但不确定为什么这个项目给了我噩梦。

项目级build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

    repositories {
        google()
        jcenter()
        maven {
            url 'https://maven.fabric.io/public'
        }

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.2'
        // Check for v3.1.2 or higher
        classpath 'com.google.gms.google-services:4.2.0'

        // Add dependency
        classpath 'io.fabric.tools:gradle:1.28.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven { url 'https://jitpack.io' }
        //maven { url 'https://maven.google.com' }

    }
}

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

app level build.gradle

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.example.architgoyal.startup_prototype"
        minSdkVersion 15
        targetSdkVersion 27
        versionCode 8
        versionName "1.6.1"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        debug {
            buildConfigField "java.util.Date", "BUILD_TIME", "new java.util.Date(" + System.currentTimeMillis() + "L)"
        }
        release {
            buildConfigField "java.util.Date", "BUILD_TIME", "new java.util.Date(" + System.currentTimeMillis() + "L)"
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    //implementation 'com.google.firebase:firebase-core:16.0.8'

    // Add dependency
    implementation 'com.crashlytics.sdk.android:crashlytics:2.9.9'
    // barcode reader library
    implementation 'info.androidhive:barcode-reader:1.1.5'
    // google vision library
    implementation 'com.google.android.gms:play-services-vision:11.0.2'
    implementation 'com.android.support:design:27.1.1'
    implementation 'com.github.GoodieBag:Pinview:v1.3'
    implementation 'com.android.support:support-v4:27.1.1'
    implementation 'me.dm7.barcodescanner:zxing:1.8.4'
    implementation 'com.android.volley:volley:1.0.0'
    implementation 'com.squareup.picasso:picasso:2.5.2'
    annotationProcessor 'com.jakewharton:butterknife:6.1.0'
    implementation 'com.jakewharton:butterknife:6.1.0'
    implementation 'com.jaredrummler:material-spinner:1.3.1'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

apply plugin: 'com.google.gms.google-services'
android firebase google-play-services crashlytics-android
2个回答
21
投票

你在classpath声明中有一个拼写错误。

这个

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

应该

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

0
投票

这是文档错误,应该如下所示

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

问题是

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

gms.google之间的点.它应该是:

© www.soinside.com 2019 - 2024. All rights reserved.