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


報錯信息

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

在嘗試打包編譯


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM