【问题标题】:Migrating to the New Places SDK Client in an old application在旧应用程序中迁移到 New Places SDK 客户端
【发布时间】:2019-11-02 06:36:18
【问题描述】:

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

项目构建.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' }
    }
}

【问题讨论】:

标签: android android-volley google-places


【解决方案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'
}}

【讨论】:

  • 我已尝试更改实现文件('libs/volley.jar')以实现 'com.android.volley:volley:1.1.0' 并且错误继续发生
  • 您是否在您的所有项目存储库中添加了jcenter() '
  • 我已经添加到 jcenter() 并且错误至少发生了变化:D 现在它显示错误:程序类型已经存在:com.android.volley.AuthFailureError
  • 我已经更新了答案,现在试试。如果它不起作用。进入 libs 文件夹并删除 volley.jar 。你不需要那个。是的!无论如何,您都应该进行备份
  • 添加所有*.exclude 组:'com.android.volley' 拯救我的一天!一切重新开始工作!非常感谢德里克
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多