迁移到New Place SDK Google时重复的jar(ListenableFuture.class) [英] Duplicate jar (ListenableFuture.class) while migrating to New Place SDK google

查看:99
本文介绍了迁移到New Place SDK Google时重复的jar(ListenableFuture.class)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用此迁移指南.但是一旦我尝试生成我的发行版或调试apk,开始出现错误

I am trying to migrate my Autocomplete widget Places SDK Google to the new one using this migration guide. But once I try to generate my release or debug apk start getting the error

Duplicate jar entry [com/google/common/util/concurrent/ListenableFuture.class]

我阅读了几个stackoverflow问题和其他参考资料,发现它是由重复的番石榴(ListenableFuture)引起的.应用程序级别的依赖关系在下面列出.

I read couple of stackoverflow questions and other references and found it was caused by duplicate guava (ListenableFuture). App level dependencies are listed below.

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation androidx.appcompat:appcompat:1.1.0-alpha01
implementation 'androidx.mediarouter:mediarouter:1.1.0-alpha01'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation 'com.google.android.libraries.places:places:1.0.0'

implementation 'com.google.android.gms:play-services-maps:16.0.0'
implementation 'com.google.android.gms:play-services-safetynet:16.0.0'
implementation 'com.google.firebase:firebase-core:16.0.7'
implementation 'com.google.firebase:firebase-messaging:17.3.4'
implementation 'com.squareup.retrofit2:retrofit:2.5.0'
implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
implementation 'com.google.android.material:material:1.1.0-alpha03'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.intuit.sdp:sdp-android:1.0.3'
implementation 'com.roughike:bottom-bar:2.3.1'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.razorpay:checkout:1.4.7'
implementation 'me.relex:circleindicator:1.2.2@aar'
implementation 'com.firebase:firebase-jobdispatcher:0.8.5'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.8'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'androidx.multidex:multidex-instrumentation:2.0.0'

}

到目前为止,我所做的是- 1.从sdk地方排除了listenablefuture

What I have done so far- 1. excluded listenablefuture from places sdk

implementation ('com.google.android.libraries.places:places:1.0.0'){
    exclude group: 'com.google.guava', module: 'listenablefuture'
}

结果相同. ListenableFuture仍存在重复的jar输入错误

Result was same. Still Duplicate jar entry error for listenablefuture

  1. 从sdk地方排除了整个番石榴

  1. excluded entire guava from places sdk

实施('com.google.android.libraries.places:places:1.0.0'){ 排除组:"com.google.guava" }

implementation ('com.google.android.libraries.places:places:1.0.0'){ exclude group: 'com.google.guava' }

结果没有错误.但是安装了apk,当我运行包含自动完成小部件的活动时,它会收到以下错误,导致应用崩溃.

Result was NO error. But apk installed, when i runing my activity containing the autocomplete widget, it get the below error and app crashes.

Fatal Exception: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/common/base/Preconditions;
   at com.google.android.libraries.places.api.Places.initialize(Unknown Source:5)
   at com.google.android.libraries.places.api.Places.initialize(Unknown Source:1)
   at com.proyujan.proyujan.MapLeadActivity.onCreate(Unknown Source:26)
   at android.app.Activity.performCreate(Activity.java:7372)
   at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1218)
   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3147)
   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3302)
   at android.app.ActivityThread.-wrap12(Unknown Source)
   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1891)
   at android.os.Handler.dispatchMessage(Handler.java:108)
   at android.os.Looper.loop(Looper.java:166)
   at android.app.ActivityThread.main(ActivityThread.java:7425)
   at java.lang.reflect.Method.invoke(Method.java)
   at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921)

  1. 在我的appcompat依赖项中找到了listenablefuture模块.步骤1和步骤2是否也与appcompat兼容,但结果相同.

请帮助.如何解决这个问题.

Please help. How to solve this.

推荐答案

已解决:终于找到了解决方案.我说过,在为Places SDK添加新的依赖库时发现了可听的将来的重复项,重复项在AppCompat库中.

SOLVED: Finally found a solution. I stated earlier listenable future duplication was found while adding new dependency library for places SDK, duplicate being in the AppCompat library.

我正在使用最新的AppCompat库,这就是问题所在.根据Google文档,稳定版本为1.0.0.因此,一旦我将所有内容恢复到稳定版本,问题就解决了.

I was using the latest AppCompat library and here was the problem. It seems as per google docs, stable version is 1.0.0. So once I revert back everything to the stable version, the problem was solved.

implementation 'androidx.appcompat:appcompat:1.0.0'

并且不需要以下内容:

configurations {
    all*.exclude group: 'com.google.guava', module: 'listenablefuture'
}

这篇关于迁移到New Place SDK Google时重复的jar(ListenableFuture.class)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆