一个 AAR 库已经使用了 com.google.guava。
如果一个应用在它的 build.gradle 中包含以下内容:
api 'com.google.guava:guava:27.0-android'
构建应用程序会生成以下错误:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: ...
Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
Program type already present: com.google.common.util.concurrent.internal.InternalFutures
如果我不包含“api'com.google.guava:guava:27.0-android'”,那么应用程序可以构建,但是当它到达使用Guava方法Iterables.find的点时,它会发生java.lang.NoClassDefFoundError的运行时错误。