java - Guava vs Google Play服务:构建冲突

标签 java android gradle google-play-services guava

我想在同一项目中使用Guava和GooglePlayServices。通过gradle添加Guava后,出现了dex构建错误。我能够将冲突的罪魁祸首隔离为GooglePlayServices。我可以使用其中一个,也可以不使用两者。

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.android.gms:play-services:7.5.0'
compile group: 'com.google.guava', name: 'guava', version: '18.0'}

还有其他人遇到吗?解决方案表示赞赏。

最佳答案

我认为您遇到了65k方法限制问题。

最简单的解决方法是只包含所需的内容,而不是包含整个Google Play服务库。
参见https://developers.google.com/android/guides/setup#split

有关65k问题的更多信息:
看到
https://www.contentful.com/blog/2014/10/30/android-and-the-dex-64k-methods-limit/

关于java - Guava vs Google Play服务:构建冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32094754/

相关文章:

java - 即使用户切换应用程序,CountDownTimer 也会运行

Javacc 包问题

Android 应用程序需要用户先登录

android - ListView 刷新

java - 覆盖 gradle 中的 Spring Starter Version 版本

java - 在 DIV HTML 中遍历或查找元素的最快方法

java - 哪里应该使用AsyncTask,哪里不应该使用AsyncTask?

android - 如何查找哪个库使用 AndroidX

android - java.exe 以非退出值 2 结束

gradle - 我需要调试技巧来解决项目依赖项的问题