尝试在Android Studio中编译代码时Google API gradle错误

时间:2019-01-12 20:27:51

标签: android-studio gradle compiler-errors google-api

我一直在遵循有关如何使应用程序类似于uber的指南,我似乎遇到了指南未解决的问题。如何让Android Studio为我的包名称找到匹配的客户端?另外,我该如何更新代码中所述的Firebase版本?

我收到一条错误消息,内容为“ org.gradle.api.GradleException:找不到与包名称'com.NovaTaxi.uber'相匹配的客户端”

我能够找到并测试的第一个解决方案是更改文件名,以使其与项目名称不匹配,这没有帮助。接下来,我尝试下载完整版本的代码,以查看它是否适合我运行,以尝试找出问题所在并将其替换为我自己的工作。无济于事,由于相同的错误,它也不会运行。

有很多代码,我无法查明错误,所以我将提供部分错误,然后提供指向vide / github的链接,以便您有更好的范围。 / p>


    apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion '26.0.2'
    defaultConfig {
        applicationId "com.NovaTaxi.uber"
        minSdkVersion 16
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation 'com.google.firebase:firebase-core:16.0.1'
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })

    //noinspection GradleCompatible
    compile 'com.android.support:appcompat-v7:26.1.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.google.firebase:firebase-core:11.6.0'
    compile 'com.google.firebase:firebase-database:11.6.0'
    compile 'com.google.firebase:firebase-auth:11.6.0'
    compile 'com.google.firebase:firebase-storage:11.6.0'
    compile 'com.firebase:geofire-android:2.1.1'
    compile 'com.google.android.gms:play-services:11.6.0'
    compile 'com.github.bumptech.glide:glide:4.0.0'
    compile 'com.android.support:design:26.1.0'
    compile 'com.android.support:cardview-v7:26.1.0'
    compile 'com.github.jd-alexander:library:1.1.0'

    compile 'com.paypal.sdk:paypal-android-sdk:2.15.3'
    testCompile 'junit:junit:4.12'
}


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



// 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.0.1'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        google()
    }
}

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

应该没有错误,但是因为我认为是gradle兼容问题而无法编译。

1 个答案:

答案 0 :(得分:0)

删除 应用插件:“ com.google.gms.google-services” 从文件开始,然后重试同步