Flutter 编译打包安卓com.google.common.util.concurrent.ListenableFuture found in modules guava-20.0.jar

it2025-10-12  10

报错信息

FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:checkDebugDuplicateClasses'. > 1 exception was raised by workers: java.lang.RuntimeException: Duplicate class com.google.common.util.concurrent.ListenableFuture found in modules guava-20.0.jar (com.google.guava:guava:20.0) and listenablefuture-1.0.jar (com.google.guava:listenablefuture:1.0) Go to the documentation to learn how to <a href="d.android.com/r/tools/classpath-sync-errors">Fix dependency resolution errors</a>.

重读类 com.google.guava 导致的

本地的Flutter 升级了一次SDK,就出这个错误

1.先查看android/gradle.properties文件 有没有 

android.useAndroidX=true android.enableJetifier=true

没有的话 加上,工程本身就有 可以不用管

2./android/app/build.gradle中

 

 添加

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

在尝试打包编译

 

最新回复(0)