迁移到 New Places SDK 时遇到的问题

Facing problems while Migrating to the New Places SDK

当我尝试迁移到 New Places SDK 并添加新的地点依赖项时,如下所示:

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

它为下面的其他依赖项提供了很多错误。

Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.github.bumptech.glide:glide:4.3.1.

Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.google.code.gson:gson:2.8.5.

Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.mcxiaoke.volley:library:1.0.19.

Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.github.bumptech.glide:glide:4.3.1.

我收到与上面类似的 40 错误。

当我删除 places 库项目时工作正常。

我的应用级 gradel 文件依赖如下:

dependencies {
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    compile 'com.android.support:multidex:1.0.1'
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile('com.crashlytics.sdk.android:crashlytics:2.6.1@aar') {
        transitive = true;
    }
    implementation 'com.facebook.android:facebook-android-sdk:4.1.0'
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support:support-annotations:27.1.1'
    implementation 'com.android.support:design:27.1.1'
    implementation 'com.jakewharton:butterknife:7.0.1'
    implementation 'com.github.bumptech.glide:glide:3.7.0'
    implementation 'com.android.support:cardview-v7:27.1.1'
    implementation 'com.google.android.gms:play-services-maps:16.1.0'
    implementation 'com.google.android.gms:play-services-location:16.0.0'
    implementation 'com.google.android.libraries.places:places:1.0.0'
    implementation 'com.google.guava:guava-collections:r03'
    implementation 'com.etsy.android.grid:library:1.0.5'
    implementation 'com.wdullaer:materialdatetimepicker:2.5.0'
    implementation 'com.google.firebase:firebase-messaging:17.4.0'
    implementation 'com.google.firebase:firebase-core:16.0.8'
    implementation 'com.daimajia.numberprogressbar:library:1.2@aar'
    implementation 'com.google.code.gson:gson:2.8.5'
    implementation 'com.mcxiaoke.volley:library:1.0.19'
    implementation 'com.theartofdev.edmodo:android-image-cropper:2.3.+'
    implementation 'org.apache.httpcomponents:httpcore:4.4.5'
    implementation 'org.apache.httpcomponents:httpclient:4.5'
    compile project(':mediapicker')
    //compile project(':linkedin-sdk')
    compile project(':sinch-android-rtc-3.11.1')
}

我的项目级 Greadle 文件如下:

buildscript {
    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name '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()
        maven {
            url 'https://maven.google.com/'
        }
    }
}

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

我在 2 天前就遇到了这个错误,请提供一些解决方案。

如下更新您的项目级依赖项:

classpath 'com.android.tools.build:gradle:3.3.0'
classpath 'com.google.gms:google-services:4.1.0'

并如下更新您的应用级依赖项:

implementation 'com.github.bumptech.glide:glide:4.9.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'

不要忘记在您的应用级别末尾添加 "apply plugin: 'com.google.gms.google-services'" gradle

如果还是不行,那么你必须按照下面的方法做:

//exclude glide coming from place api
implementation ('com.google.android.libraries.places:places:1.0.0'){
    exclude module: 'glide'
}