如何解决'Program type already present: com.google.common.util.concurrent.ListenableFuture'?
How to solve 'Program type already present: com.google.common.util.concurrent.ListenableFuture'?
我正在尝试使用 WorkManager 1.0.0-alpha09。并收到此错误:
Program type already present:
com.google.common.util.concurrent.ListenableFuture
Message{kind=ERROR, text=Program type already present:
com.google.common.util.concurrent.ListenableFuture, sources=[Unknown source
file], tool name=Optional.of(D8)}
如果我使用 1.0.0-alpha08 或更低版本。我没有收到此错误,但我需要 public 构造函数
public Worker(Context context, WorkerParameters workerParams)
看看https://issuetracker.google.com/issues/116154359。
解决方法是:
implementation("android.arch.work:work-runtime:1.0.0-alpha09") {
exclude group: 'com.google.guava', module: 'listenablefuture'
}
就我而言,我必须将以下配置添加到应用程序的模块 build.gradle
:
configurations {
all*.exclude group: 'com.google.guava', module: 'listenablefuture'
}
这是因为某些依赖项同时使用了 com.google.guava:guava
和 com.google.guava:listenablefuture
。它会导致依赖冲突。
我只是在我的应用程序 gradle 文件的末尾添加了 implementation 'com.google.guava:guava:27.0.1-android'
,错误就消失了。
我正在使用来自工作管理器的 ListenableFuture
。
implementation("android.arch.work:work-runtime:1.0.0")
所以排除 exclude group: 'com.google.guava', module: 'listenablefuture'
,对我没用。
我正在使用内部使用 androidTestImplementation "com.google.truth:truth:42"
的依赖项,内部使用 com.google.guava:guava:25.0.1-android
。这导致了我的问题。
将 com.google.truth:truth
升级到 43
为我解决了这个问题。
我正在尝试使用 WorkManager 1.0.0-alpha09。并收到此错误:
Program type already present:
com.google.common.util.concurrent.ListenableFuture
Message{kind=ERROR, text=Program type already present:
com.google.common.util.concurrent.ListenableFuture, sources=[Unknown source
file], tool name=Optional.of(D8)}
如果我使用 1.0.0-alpha08 或更低版本。我没有收到此错误,但我需要 public 构造函数
public Worker(Context context, WorkerParameters workerParams)
看看https://issuetracker.google.com/issues/116154359。
解决方法是:
implementation("android.arch.work:work-runtime:1.0.0-alpha09") {
exclude group: 'com.google.guava', module: 'listenablefuture'
}
就我而言,我必须将以下配置添加到应用程序的模块 build.gradle
:
configurations {
all*.exclude group: 'com.google.guava', module: 'listenablefuture'
}
这是因为某些依赖项同时使用了 com.google.guava:guava
和 com.google.guava:listenablefuture
。它会导致依赖冲突。
我只是在我的应用程序 gradle 文件的末尾添加了 implementation 'com.google.guava:guava:27.0.1-android'
,错误就消失了。
我正在使用来自工作管理器的 ListenableFuture
。
implementation("android.arch.work:work-runtime:1.0.0")
所以排除 exclude group: 'com.google.guava', module: 'listenablefuture'
,对我没用。
我正在使用内部使用 androidTestImplementation "com.google.truth:truth:42"
的依赖项,内部使用 com.google.guava:guava:25.0.1-android
。这导致了我的问题。
将 com.google.truth:truth
升级到 43
为我解决了这个问题。