Flutter构建apk:在模块guava-26.0-android.jar和listenablefuture-1.0.jar中找到重复的类 [英] Flutter building apk: Duplicate class found in modules guava-26.0-android.jar and listenablefuture-1.0.jar

查看:95
本文介绍了Flutter构建apk:在模块guava-26.0-android.jar和listenablefuture-1.0.jar中找到重复的类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在尝试在Flutter上构建APK时遇到了一个奇怪的错误:

I am getting a strange bug trying to build apk on Flutter:

% flutter build apk --no-shrink
You are building a fat APK that includes binaries for android-arm, android-arm64, android-x64.
If you are deploying the app to the Play Store, it's recommended to use app bundles or split the APK to reduce the APK size.
    To generate an app bundle, run:
        flutter build appbundle --target-platform android-arm,android-arm64,android-x64
        Learn more on: https://developer.android.com/guide/app-bundle
    To split the APKs per ABI, run:
        flutter build apk --target-platform android-arm,android-arm64,android-x64 --split-per-abi
        Learn more on:  https://developer.android.com/studio/build/configure-apk-splits#configure-abi-split
                                                                        
FAILURE: Build failed with an exception.                                
                                                                        
* What went wrong:                                                      
Execution failed for task ':app:checkReleaseDuplicateClasses'.          
> 1 exception was raised by workers:                                    
  java.lang.RuntimeException: Duplicate class com.google.common.util.concurrent.ListenableFuture found in modules guava-26.0-android.jar (com.google.guava:guava:26.0-android) 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>.
                                                                        
                                                                        
* Try:                                                                  
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
                                                                        
* Get more help at https://help.gradle.org                              
                                                                        
BUILD FAILED in 29s                                                     
Running Gradle task 'assembleRelease'...                                
Running Gradle task 'assembleRelease'... Done                      30.3s
Gradle task assembleRelease failed with exit code 1
joao@Mini-de-Joao opengames % flutter build apk --no-shrink
You are building a fat APK that includes binaries for android-arm, android-arm64, android-x64.
If you are deploying the app to the Play Store, it's recommended to use app bundles or split the APK to reduce the APK size.
    To generate an app bundle, run:
        flutter build appbundle --target-platform android-arm,android-arm64,android-x64
        Learn more on: https://developer.android.com/guide/app-bundle
    To split the APKs per ABI, run:
        flutter build apk --target-platform android-arm,android-arm64,android-x64 --split-per-abi
        Learn more on:  https://developer.android.com/studio/build/configure-apk-splits#configure-abi-split
                                                                        
FAILURE: Build failed with an exception.                                
                                                                        
* What went wrong:                                                      
Execution failed for task ':app:checkReleaseDuplicateClasses'.          
> 1 exception was raised by workers:                                    
  java.lang.RuntimeException: Duplicate class com.google.common.util.concurrent.ListenableFuture found in modules guava-26.0-android.jar (com.google.guava:guava:26.0-android) and listenablefuture-1.0.jar (com.google.guava:listenablefuture:1.0)
                      

有什么想法吗?

推荐答案

从此 2020解决方案

Google知道此错误,因此他们制作了一个特殊的程序包来解决冲突.

Google knows about this error so they made a special package to fix the conflict.

将此添加到您的build.gradle

Add this to your build.gradle

实现'com.google.guava:listenablefuture:9999.0-empty-to-以避免冲突与番石榴'

这篇关于Flutter构建apk:在模块guava-26.0-android.jar和listenablefuture-1.0.jar中找到重复的类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆