首页 > 解决方案 > Gradle 设置不同步

问题描述

我已经更改了我的一些 gradle 设置但是我收到一个错误,指出存在版本冲突但是代码中没有错误

app build.gradle:

apply plugin: 'com.android.application'

android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
    applicationId "net.simplifiedlearning.firebaseauth"
    minSdkVersion 19
    targetSdkVersion 27
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    vectorDrawables.useSupportLibrary = true
    multiDexEnabled true
}

packagingOptions {
    exclude 'META-INF/DEPENDENCIES'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/NOTICE.txt'
    exclude 'META-INF/LICENSE.txt'
}


buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {

implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:customtabs:27.1.1'

implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:support-vector-drawable:27.1.1'
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.github.bumptech.glide:glide:4.7.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.7.1'


implementation 'com.android.support.constraint:constraint-layout:1.1.2'
testImplementation 'junit:junit:4.12'
implementation 'de.hdodenhof:circleimageview:2.2.0'

implementation 'com.google.android.gms:play-services-maps:15.0.1'
implementation 'com.google.android.gms:play-services-location:15.0.1'
implementation 'com.google.android.gms:play-services-ads:15.0.1'
implementation 'com.google.android.gms:play-services-auth:15.0.1'
implementation 'com.google.android.gms:play-services-gcm:15.0.1'


implementation 'com.rengwuxian.materialedittext:library:2.1.4'
implementation 'com.firebase:firebase-client-android:2.5.2'

implementation 'com.firebaseui:firebase-ui-database:3.3.1'
implementation 'com.firebaseui:firebase-ui-auth:3.3.1'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.firebase:firebase-auth:11.8.0'
implementation 'com.google.firebase:firebase-storage:11.8.0'

implementation 'com.android.support:multidex:1.0.3'

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

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

错误:

请通过更新 google-services 插件的版本来修复版本冲突(有关最新版本的信息可在https://bintray.com/android/android-tools/com.google.gms.google-services/获得)或将 com.google.android.gms 的版本更新为 15.0.1。

产品级 build.gradle:

// 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.0.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.1.2'
}
}

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

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

标签: javaandroid

解决方案


在项目级别 build.gradle 中,将 google 服务版本从更改3.1.24.0.0


推荐阅读