执行 com.android.build.gradle.internal.tasks.Workers$ActionFacade 时发生故障 Flutter clean 后
Posted
技术标签:
【中文标题】执行 com.android.build.gradle.internal.tasks.Workers$ActionFacade 时发生故障 Flutter clean 后【英文标题】:A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade After flutter clean 【发布时间】:2021-04-14 23:59:44 【问题描述】:Running Gradle task 'assembleDebug'...
java.nio.file.NoSuchFileException: C:\Users\nobit\androidStudioProjects\Production\secret_keeper\build\app\intermediates\external_file_lib_dex_archives\debug\out
at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:79)
at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97)
at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102)
at sun.nio.fs.WindowsDirectoryStream.<init>(WindowsDirectoryStream.java:80)
at sun.nio.fs.WindowsFileSystemProvider.newDirectoryStream(WindowsFileSystemProvider.java:522)
at java.nio.file.Files.newDirectoryStream(Files.java:457)
at java.nio.file.Files.list(Files.java:3451)
at com.android.build.gradle.internal.tasks.DexMergingParams.getAllDexFiles(DexMergingTask.kt:502)
at com.android.build.gradle.internal.tasks.DexMergingTaskRunnable.run(DexMergingTask.kt:423)
at com.android.build.gradle.internal.tasks.Workers$ActionFacade.run(Workers.kt:335)
at org.gradle.workers.internal.AdapterWorkAction.execute(AdapterWorkAction.java:50)
at org.gradle.workers.internal.DefaultWorkerServer.execute(DefaultWorkerServer.java:47)
at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1$1.create(NoIsolationWorkerFactory.java:65)
at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1$1.create(NoIsolationWorkerFactory.java:61)
at org.gradle.internal.classloader.ClassLoaderUtils.executeInClassloader(ClassLoaderUtils.java:98)
at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1.execute(NoIsolationWorkerFactory.java:61)
at org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:44)
at org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:41)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:102)
at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
at org.gradle.workers.internal.AbstractWorker.executeWrappedInBuildOperation(AbstractWorker.java:41)
at org.gradle.workers.internal.NoIsolationWorkerFactory$1.execute(NoIsolationWorkerFactory.java:56)
at org.gradle.workers.internal.DefaultWorkerExecutor$3.call(DefaultWorkerExecutor.java:215)
at org.gradle.workers.internal.DefaultWorkerExecutor$3.call(DefaultWorkerExecutor.java:210)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runExecution(DefaultConditionalExecutionQueue.java:215)
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runBatch(DefaultConditionalExecutionQueue.java:164)
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.run(DefaultConditionalExecutionQueue.java:131)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
at java.lang.Thread.run(Thread.java:748)
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDexDebug'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> java.nio.file.NoSuchFileException: C:\Users\nobit\AndroidStudioProjects\Production\secret_keeper\build\app\intermediates\external_file_lib_dex_archives\debug\out
* 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 2m 36s
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done 163.3s (!)
Exception: Gradle task assembleDebug failed with exit code 1
在运行 flutter clean 后得到这个异常,在 clean 之前它正在工作,但在 clean 之后它显示这个异常。
颤振医生-v
[√] Flutter (Channel stable, 1.22.5, on Microsoft Windows [Version 10.0.19041.685],语言环境 en-IN) • Flutter 版本 1.22.5,位于 C:\FlutterSDK\flutter • 框架修订7891006299(4周前),2020-12-10 11:54:40 -0800 • 引擎修订版ae90085a84 • Dart 版本 2.10.4
[√] Android 工具链 - 为 Android 设备开发(Android SDK 版本 30.0.2) • Android SDK 位于 C:\Users\nobit\AppData\Local\Android\sdk • 平台 android-30,构建工具 30.0.2 • Java 二进制文件位于:C:\Program Files\Android\Android Studio\jre\bin\java • Java 版 OpenJDK 运行时环境(内部版本 1.8.0_242-release-1644-b01) • 接受所有 Android 许可证。
[!] Android Studio(版本 4.1.0) • C:\Program Files\Android\Android Studio 中的 Android Studio X Flutter 插件未安装;这增加了 Flutter 特定的功能。 X Dart 插件未安装;这增加了 Dart 特定的功能。 • Java 版 OpenJDK 运行时环境(内部版本 1.8.0_242-release-1644-b01)
[√] VS 代码(版本 1.51.1) • C:\Users\nobit\AppData\Local\Programs\Microsoft VS 代码中的 VS 代码 • Flutter 扩展版本 3.16.0
[√] 已连接设备(1 个可用) • vivo Y21L(移动) • c98e68ea • android-arm • Android 5.1.1 (API 22)
!医生发现了 1 个类别的问题。
【问题讨论】:
请查看我的回答 【参考方案1】:问题出在multidex builder上。
进入android/app/build.gradle并添加以下代码行:
dependencies
implementation "androidx.multidex:multidex:2.0.1"
android
defaultConfig
multiDexEnabled true
【讨论】:
以上是关于执行 com.android.build.gradle.internal.tasks.Workers$ActionFacade 时发生故障 Flutter clean 后的主要内容,如果未能解决你的问题,请参考以下文章