Flutter run 失败

安装插件之后,flutter run命令运行项目,报错如下:

FAILURE: Build completed with 2 failures.                               
                                                                        
1: Task failed with an exception.                                       
-----------                                                             
* What went wrong:                                                      
Execution failed for task ':app:mergeDebugNativeLibs'.                  
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
   > File 'com.android.builder.files.ZipCentralDirectory@91ba737' was deleted, but previous version not found in cache
                                                                        
* 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.
==============================================================================
                                                                        
2: Task failed with an exception.                                       
-----------                                                             
* What went wrong:                                                      
Execution failed for task ':app:mergeDebugJavaResource'.                
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
   > File 'com.android.builder.files.ZipCentralDirectory@57667dcd' was deleted, but previous version not found in cache
                                                                        
* 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 3s                                                      
Running Gradle task 'assembleDebug'...                                  
Running Gradle task 'assembleDebug'... Done                         3.8s
Exception: Gradle task assembleDebug failed with exit code 1
原因

可能是由插件版本关系影响的,建议不使用最新版本

解决办法:
  1. 清除编辑器缓存/重启编辑器
  2. 运行 flutter clean ,然后重新获取下依赖包 flutter pub get

参考:https://stackoverflow.com/questions/62760392/fluuter-failed-for-task-appmergedebugnativelibs-and-appmergedebugjavaresource

你可能感兴趣的:(Flutter run 失败)