Android Studio 3.3 + android.arch.work:work-runtime 导致编译问题

Android Studio 3.3 + android.arch.work:work-runtime causing compilation issues

我们使用的是 3.2 Android studio 以及 Workmanager 1.0.0.beta01 版。它工作正常。

升级到 3.3 后,我遇到了以下编译问题。

ERROR: Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.google.guava:listenablefuture:1.0.
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve com.google.guava:listenablefuture:1.0.
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve com.google.guava:listenablefuture:1.0.
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@release/compileClasspath': Could not resolve com.google.guava:listenablefuture:1.0.
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not resolve com.google.guava:listenablefuture:1.0.
Show Details
Affected Modules: app

我也尝试升级 workmanager 版本 1.0.0.beta02。它没有帮助。有什么建议吗?

根据 Google 问题跟踪器,似乎有一个 bug/change。

https://issuetracker.google.com/issues/116154359

在 build.gradle 中添加以下行。

dependencies {
    implementation 'android.arch.work:work-runtime:1.0.0-beta02'
    implementation 'com.google.guava:guava:27.0.1-android'
}

还在 proguard 文件中添加以下行。在生成发布版本时,我几乎没有收到来自 Guava 的警报。

-dontwarn com.google.common.base.**
-dontwarn com.google.errorprone.annotations.**
-dontwarn com.google.j2objc.annotations.**
-dontwarn java.lang.ClassValue
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement