Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
493 views
in Technique[技术] by (71.8m points)

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

I am trying to use WorkManager 1.0.0-alpha09. and getting this error:

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)}

If i use version 1.0.0-alpha08 or less. I don't get this error, but i need public constructor

public Worker(Context context, WorkerParameters workerParams)
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...