简体   繁体   English

在项目':app'中与依赖'com.google.code.gson:gson'冲突。 app(2.7)和测试app(2.8.0)的已解决版本不同

[英]Conflict with dependency 'com.google.code.gson:gson' in project ':app'. Resolved versions for app (2.7) and test app (2.8.0) differ

I am facing a very weird problem . 我面临一个非常奇怪的问题。 In my project I am retrofit as a network library . 在我的项目中,我作为网络库进行改造。 SO for JSON serialisation and deserialisation I am using gson-converter library "com.squareup.retrofit2:converter-gson:$rootProject.retrofitVersion" // rootProject.retrofitVersion = '2.3.0' 因为JSON序列化和反序列化我正在使用gson-converter库"com.squareup.retrofit2:converter-gson:$rootProject.retrofitVersion" // rootProject.retrofitVersion = '2.3.0'

after sync I got this error which failed gradle to build the app 同步之后,我收到了这个错误,无法通过gradle来构建应用程序

Error:Execution failed for task ':app:preMockDebugAndroidTestBuild'. 错误:任务':app:preMockDebugAndroidTestBuild'的执行失败。 Conflict with dependency 'com.google.code.gson:gson' in project ':app'. 在项目':app'中与依赖'com.google.code.gson:gson'冲突。 Resolved versions for app (2.7) and test app (2.8.0) differ. app(2.7)和测试app(2.8.0)的已解决版本有所不同。 See https://d.android.com/r/tools/test-apk-dependency-conflicts.html for details. 有关详细信息,请参阅https://d.android.com/r/tools/test-apk-dependency-conflicts.html

I have used retrofit and gson many times in past but never face this sort of error . 我过去曾多次使用过retrofit和gson,但从未遇到过这种错误。 Please some one help me . 请有人帮助我。 I have searched a lot , non of the solution works 我搜索了很多,非解决方案的工作原理

I have recently faced this same issue with retrofit gson convert factory . 我最近遇到了改造gson转换工厂的同样问题。 see this issue . 看到这个问题 I didn't get the solution yet though . 但我还没有得到解决方案。 I have searched a lot just like you . 我和你一样搜索了很多。 Luckily I have applied a ghostbuster solution , I repeat this is a ghostbuster solution . 幸运的是,我已经应用了一个重影解决方案我重申这是一个重点解决方案 I have no acceptable explanation for this . 我对此没有可接受的解释。

what I did I add latest total gson library as a dependency like this implementation 'com.google.code.gson:gson:2.8.0' (version may differ this one was the time of my writing) and suddenly gradle build was successful . 我做了什么我添加了最新的总gson库作为依赖,就像这个implementation 'com.google.code.gson:gson:2.8.0' (版本可能不同,这是我写作的时间),突然gradle构建成功。

please let me know if it works for you too 如果它也适合你,请告诉我

NB please before down voting add a comment , I made myself clear this one works for me . NB请在投票前添加评论,我明确表示这个对我有用。 Still I have no Idea what was wrong 我仍然不知道出了什么问题

更新版本:

implementation 'com.google.code.gson:gson:2.8.0'

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误:在项目':app'中与依赖项'com.google.guava:guava'发生冲突。 应用(18.0)和测试应用(16.0.1)的已解决版本不同 - Error:Conflict with dependency 'com.google.guava:guava' in project ':app'. Resolved versions for app (18.0) and test app (16.0.1) differ 错误:与项目':app'中的依赖项'com.android.support:support-v4'发生冲突。 应用(25.3.1)和测试应用(23.1.1)的已解决版本不同 - Error:Conflict with dependency 'com.android.support:support-v4' in project ':app'. Resolved versions for app (25.3.1) and test app (23.1.1) differ 与项目':app'中的依赖'com.android.support:support-annotations'冲突。 app(26.1.0)和测试app(27.1.1)的已解决版本有所不同。 - Conflict with dependency 'com.android.support:support-annotations' in project ':app'. Resolved versions for app (26.1.0) and test app (27.1.1) differ. gradle android studio 2.3:无法解析“com.google.code.gson:gson:2.8.0” - gradle android studio 2.3: failed to resolve 'com.google.code.gson:gson:2.8.0' 与项目':app'中的依赖项冲突。 app(15.0.2)和测试app(12.0.1)的已解决版本不同(可能是信号和firebase问题) - Conflict with dependency in project ':app'. Resolved versions for app (15.0.2) and test app (12.0.1) differ (possibly onesignal&firebase issue) Espresso错误:与依赖项“ com.android.support:support-v4”发生冲突。 应用(24.2.0)和测试应用(23.1.1)的已解决版本不同 - Espresso Error:Conflict with dependency 'com.android.support:support-v4'. Resolved versions for app (24.2.0) and test app (23.1.1) differ 与依赖'com.android.support:support-annotations'冲突。 app(23.3.0)和测试app(23.1.1)的已解决版本有所不同 - Conflict with dependency 'com.android.support:support-annotations'. Resolved versions for app (23.3.0) and test app (23.1.1) differ 与依赖'com.android.support:support-annotations'冲突。 app(23.1.0)和测试app(23.0.1)的已解决版本有所不同 - Conflict with dependency 'com.android.support:support-annotations'. Resolved versions for app (23.1.0) and test app (23.0.1) differ Android Studio:无法解析com.google.code.gson:gson:2.7 - Android Studio: Could not resolve com.google.code.gson:gson:2.7 无法解决:com.google.code.gson:gson:2.3.1 - Failed to resolve: com.google.code.gson:gson:2.3.1
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM