Android Build execution failed due to incompatible library versions

[亡魂溺海] 提交于 2020-01-26 04:56:39

问题


Implementing Google sign in using firebase.

This is my project level build.gradle

buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
        classpath 'com.google.gms:google-services:3.0.0'

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

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

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

This is my App level build.gradle

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "wallet.mycoin"
        minSdkVersion 16
        targetSdkVersion 26
        versionCode 1
        versionName "0.2"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.android.support:design:26.1.0'
    compile 'com.google.code.gson:gson:2.8.2'
    compile 'com.squareup.retrofit:retrofit:1.9.0'
    compile 'com.squareup.okhttp:okhttp:2.4.0'
    compile 'com.squareup.okio:okio:1.5.0'
    compile 'com.squareup.okhttp:okhttp-urlconnection:2.4.0'
    compile 'com.google.firebase:firebase-auth:11.8.0'
    compile 'com.google.android.gms:play-services-auth:11.8.0'
}

While building i am getting an error like >

Error:Execution failed for task ':app:processDebugGoogleServices'. Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 9.0.0.

<<

And

All firebase/gms libraries must use the exact same specification (mixing versions can lead to run time crashes) Found versions 9.0.0 and 11.8.0. Examples include com.google.firebase:firebase-analytics:9.0.0 and com.google.android.gms:play-services-auth:11.8.0.

There are some combinations of libraries , or tools and libraries that are incompatible, or can lead to bugs. One such incompatibility compiling with a version of Android support library that is not the latest version (or in a particular version lower than targetSdkVersion)

There is no firebase analytics library added in the project. Can anyone suggest a solution. Build failed.


回答1:


dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:design:26.1.0'
compile 'com.google.code.gson:gson:2.8.2'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.squareup.okhttp:okhttp:2.4.0'
compile 'com.squareup.okio:okio:1.5.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.4.0'
compile 'com.google.firebase:firebase-auth:11.8.0'
compile 'com.google.android.gms:play-services-auth:11.8.0'
}
apply plugin: 'com.google.gms.google-services'

Use this file , remember to add google-services configuration file .



来源:https://stackoverflow.com/questions/47919110/android-build-execution-failed-due-to-incompatible-library-versions

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!