当我尝试使用新的places-compat时出现问题

时间:2019-03-07 17:51:46

标签: java android

我尝试使用新的placeApi,我遵循此文档https://developers.google.com/places/android-sdk/client-migration#place-picker-deprecation,当我运行我的应用时,android studio返回此

错误:从com.google.android.libraries.places.internal.fm

引用com.google.android.libraries.places.internal.lm作为接口。

: “ 原因:com.android.builder.dexing.DexArchiveBuilderException:无法处理C:\ Users \ 14155709.gradle \ caches \ transforms-1 \ files-1.1 \ places-1.0.0.aar \ 2f69114c5b5de5e9392ef400dc02f6f031 \ jars \ classes.jar

当我输入以下内容时,就会出现此问题:实现'com.google.android.libraries.places:places-compat:1.0.0'

以及以下内容:实现'com.google.android.libraries.places:places:1.0.0'

我需要bout工具,我尝试在Google上搜索,但没有发现,请帮助我。

这是我的gradle项目:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.2'
        classpath 'com.google.gms:google-services:4.2.0'
        

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

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

这是我的gradle应用程序:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.motoja.motojapassageiro"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.google.android.gms:play-services-maps:16.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.android.support:design:28.0.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    //firebase
    implementation 'com.google.firebase:firebase-core:16.0.4'
    implementation 'com.google.firebase:firebase-database:16.0.3'
    implementation 'com.google.firebase:firebase-auth:16.0.4'
    //maps places
    implementation 'com.google.android.libraries.places:places-compat:1.0.0'
    //implementation 'com.android.support:cardview-v7:28.0.0'
    //implementation 'com.google.android.gms:play-services-places:16.0.+'
    implementation 'com.google.android.libraries.places:places:1.0.0'
    //google-play
    implementation 'com.google.android.gms:play-services-auth:16.0.0'
    implementation 'com.firebaseui:firebase-ui-auth:4.0.1'
    // Required only if Facebook login support is required
    implementation 'com.facebook.android:facebook-android-sdk:4.40.0'
    implementation 'com.facebook.android:facebook-android-sdk:[4,5)'


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

1 个答案:

答案 0 :(得分:1)

这两个依赖项可能相互冲突:

// implementation "com.google.android.libraries.places:places-compat:1.1.0"
implementation "com.google.android.libraries.places:places:1.1.0"

places-compat包装器不是必需的-更好地将代码重构到新库中。