【问题标题】:Android Studio, Google Firebase, Google MapsAndroid Studio、谷歌 Firebase、谷歌地图
【发布时间】:2017-08-16 18:37:24
【问题描述】:

我在 mac mini 上使用 Android Studio 2.3。

我首先打开了一个新项目。

MainActivity 是一个 loadingScreen

connect project to firebase using Firebase Assistant
Write to firebase

一切正常。

然后我尝试添加一个 GoogleMaps Activity 并且该项目不再编译。我显示的错误是:

错误:任务 ':app:processDebugGoogleServices' 执行失败。 请通过更新 google-services 插件的版本(有关最新版本的信息可在 https://bintray.com/android/android-tools/com.google.gms.google-services/ 获得)或将 com.google.android.gms 的版本更新为 10.0.1 来解决版本冲突。

app build.gradle
    apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.0"
    defaultConfig {
        applicationId "us.n_e_ar.akita"
        minSdkVersion 14
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    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'
    })
    compile 'com.android.support:appcompat-v7:25.3.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha8'
    compile 'com.google.firebase:firebase-database:10.0.1'
    compile 'com.google.android.gms:play-services-maps:10.2.1'
    testCompile 'junit:junit:4.12'
}



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

这是另一个 gradle 文件

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

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        classpath 'com.google.gms:google-services:3.0.0'
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

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

提前谢谢你。

【问题讨论】:

    标签: android google-maps android-studio firebase


    【解决方案1】:

    Firebase 和 Google Play 服务库的版本必须相同。您可以降级到 10.0.1:

    compile 'com.google.firebase:firebase-database:10.0.1'
    compile 'com.google.android.gms:play-services-maps:10.0.1'
    

    或升级到 10.2.1:

    compile 'com.google.firebase:firebase-database:10.2.1'
    compile 'com.google.android.gms:play-services-maps:10.2.1'
    

    在更新时,最好使用最新的约束布局库:

    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    

    【讨论】:

    • 谢谢!!!!,我知道错误在哪里,但不完全是自动生成的。像魅力一样工作。可能救了我一个星期。
    猜你喜欢
    • 1970-01-01
    • 2021-11-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多