在旧的应用程序中迁移到New Places SDK客户端

时间:2019-06-19 13:37:48

标签: android android-volley google-places

我正在尝试迁移到应用程序内的新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' }
    }
}

1 个答案:

答案 0 :(得分:1)

请确认您的应用级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'
}}