java - 当我尝试使用新的地方兼容时出现问题

标签 java android

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

错误:类型 com.google.android.libraries.places.internal.lm 被引用为 com.google.android.libraries.places.internal.fm 中的接口(interface)”

还有这个: “由以下原因引起:com.android.builder.dexing.DexArchiveBuilderException:无法处理 C:\Users\14155709.gradle\caches\transforms-1\files-1.1\places-1.0.0.aar\2f69114c5b5de9392ef400dc02f6f031\jars\classes.jar"

当我输入以下内容时,这个问题就开始了:实现'com.google.android.libraries.places:places-compat:1.0.0'

还有这个:实现“com.google.android.libraries.places:places:1.0.0”

我需要一些工具,我尝试在谷歌上搜索,但没有找到注释,请帮助我。

这是我的 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'

最佳答案

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

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

places-compat 包装器通常不是必需的 - 最好将代码重构到新库。

关于java - 当我尝试使用新的地方兼容时出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55050034/

相关文章:

android - 如何在 Android 上处理未完成的 UI 请求

java - 如何在 JEE Web 应用程序的 View 部分中以加密形式显示用户 ID?

java - Mongodb 查询列表<Map<String, Map<String, String>>>

java - 'mvn' 不是内部或外部命令,也不是可运行的程序或批处理文件

java.lang.NoSuchMethodError : No static method combineMeasuredStates(II)I in class 错误

android - 如何在Android中将一个 fragment 分成两种颜色

java - Android Studio 如何在屏幕上打印可变内容(数字)

java - 如何使用 `onSaveInstanceState`?

java - 如何在 Android 上仅更新 Firebase 数据库上的特定字段

java - 如何检测消息(字符串)中的电话号码,突出显示它们并允许用户在 Android 中调用这些号码?