Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter failed for task app:mergeDebugNativeLibs and app:mergeDebugJavaResource

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@6f58452a' 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@48b70346' 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 23s Running Gradle task 'assembleDebug'... Running Gradle task 'assembleDebug'... Done 23.9s Exception: Gradle task assembleDebug failed with exit code 1

like image 593
Snivio Avatar asked Jul 06 '20 16:07

Snivio


2 Answers

Try any one of the following steps:

  1. Goto Files > Click Invalidate Caches/Restart

  2. Restart your machine

  3. On terminal write flutter clean and then flutter run

like image 180
Devyank Shaw Avatar answered Oct 13 '22 12:10

Devyank Shaw


I had the same issue after setting up my flutter project to run on iOS. When I tried to run it back on Android, this error was thrown.

This worked for me (on Windows):

  1. Close your project and close your code editor

  2. Open Task Manager

  3. Finish all vscode-related tasks you see (or related to the IDE you are using)

  4. Finish all Java-related tasks, inclidung OpenJDK Platform binary (there are usually two of these; finish both)

  5. Go to your project's root folder and delete the build folder

  6. Open your project again and run

Good luck!

like image 35
Alexander Barragán Avatar answered Oct 13 '22 13:10

Alexander Barragán