在旧应用程序中迁移到 New Places SDK Client

Migrating to the New Places SDK Client in an old application

我正在尝试迁移到应用程序内的新 sdk 客户端。 当我试图在 build.gradle 中引入实现时,应用程序抛出异常。我能做些什么来解决它?

我尝试过的:

我在 build.gradle 中包含了以下实现

implementation 'com.google.android.libraries.places:places-compat:1.1.0'

我也试过

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

两者都抛出以下错误

Unable to resolve dependency for project : Could not resolve com.android.volley:volley:1.1.1.

我能做些什么来让它兼容吗? 我需要做哪些改变?

这是我的 build.gradle 依赖项

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation files('libs/volley.jar')
    implementation('de.keyboardsurfer.android.widget:crouton:1.8.1') {
        exclude group: 'com.google.android', module: 'support-v4'
        implementation 'com.google.maps.android:android-maps-utils:0.3+'
    }
    annotationProcessor 'org.parceler:parceler:1.1.1'
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support:support-v4:27.1.1'
    implementation 'com.android.support:design:27.1.1'
    implementation 'com.google.android.gms:play-services-maps:16.1.0'
    implementation 'com.google.android.gms:play-services-analytics:16.0.7'
    implementation 'com.google.android.libraries.places:places-compat:1.1.0'
    implementation 'com.google.android.gms:play-services-location:16.0.0'
    implementation 'com.google.code.gson:gson:2.7'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.squareup:otto:1.3.5'
    implementation 'com.squareup.picasso:picasso:2.3.2'
    annotationProcessor 'io.realm:realm-android:0.82.0-SNAPSHOT'
    implementation 'io.realm:realm-android:0.82.0-SNAPSHOT'
    implementation 'com.android.support:multidex:1.0.1'
    implementation 'org.parceler:parceler-api:1.1.1'
    implementation 'org.apache.amber:amber-oauth2-client:0.22-incubating'
    implementation 'org.apache.amber:amber-oauth2-common:0.22-incubating'
    implementation 'org.slf4j:slf4j-api:1.7.12'
}

项目build.gradle

buildscript {
    repositories {
        mavenCentral()

        maven {
            url 'http://oss.jfrog.org/artifactory/oss-snapshot-local'

            }
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
        classpath 'com.google.gms:google-services:3.0.0'
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'

    }
}


allprojects {
    repositories {
        mavenCentral()
        maven { url 'http://oss.jfrog.org/artifactory/oss-snapshot-local' }
    }
}

请验证您是否已将此存储库添加到您的应用级别 gradle 文件

allprojects {

    repositories {
         jcenter()
    }
}

也更改此行

implementation files('libs/volley.jar')

implementation 'com.android.volley:volley:1.1.0'

因为你面临问题Program type already present: com.android.volley.AuthFailureError

将此添加到您的应用程序目录中 build.gradle

android{
configurations {
    all*.exclude group: 'com.android.volley'
}}