How to solve 'Program type already present: com.google.common.util.concurrent.ListenableFuture'?

In my case, I had to add the following configurations to app's module build.gradle:

configurations {
    all*.exclude group: 'com.google.guava', module: 'listenablefuture'
}

It happens because some dependencies use com.google.guava:guava and com.google.guava:listenablefuture together. It causes a dependency conflict.


Take a look at https://issuetracker.google.com/issues/116154359.

The workaround is:

implementation("android.arch.work:work-runtime:1.0.0-alpha09") {
    exclude group: 'com.google.guava', module: 'listenablefuture' 
}

I merely added implementation 'com.google.guava:guava:27.0.1-android' at the end of my app gradle file and the error went away.