首页 > 解决方案 > Places API 设置在 build.gradle 设置期间出错

问题描述

我一添加

compile 'com.google.android.libraries.places:places:1.0.0'

它开始给我错误

Cause: duplicate entry: com/bumptech/glide/GeneratedAppGlideModule.class

我的 build.gradle 代码是

apply plugin: 'com.android.application'

    android {
        compileSdkVersion 26
        buildToolsVersion "26.0.0"
        defaultConfig {
            applicationId "com.videep.carpool"
            minSdkVersion 16
            targetSdkVersion 26
            versionCode 1
            versionName "1.0"
            testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
            multiDexEnabled true
            configurations.all {
                resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
            }

        }
        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'
        })

        //noinspection GradleCompatible
        compile 'com.android.support:appcompat-v7:25.3.1'
        compile 'com.android.support.constraint:constraint-layout:1.0.2'
        compile 'com.google.firebase:firebase-core:11.0.4'
        compile 'com.google.firebase:firebase-database:11.0.4'
        compile 'com.google.firebase:firebase-auth:11.0.4'
        compile 'com.google.firebase:firebase-storage:11.0.4'
        compile 'com.firebase:geofire-android:2.1.1'
        compile 'com.google.android.gms:play-services:11.0.4'
        compile 'com.github.bumptech.glide:glide:4.3.1'
        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'
        testCompile 'junit:junit:4.12'
        compile 'com.google.android.libraries.places:places:1.0.0'

    }












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

标签: androidandroid-gradle-plugin

解决方案


为 Glide 添加最新版本的依赖项。

 repositories {
  mavenCentral()
  google()
}

dependencies {
  implementation 'com.github.bumptech.glide:glide:4.9.0'
  annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
}

这个问题在 glide 库中。它已在最新版本中修复。请检查链接以供参考


推荐阅读