Reputation: 93
I have created a new flutter project and out of nowhere it gives me the following errors when I run the default application (no edits made).
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> Multiple task action failures occurred:
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource compilation failed
C:\Users\bvenh\Documents\flutter\flutter_app_5\build\app\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml: AAPT: error: file failed to compile.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource compilation failed
C:\Users\bvenh\Documents\flutter\flutter_app_5\build\app\intermediates\incremental\mergeDebugResources\merged.dir\values-hi\values-hi.xml: AAPT: error: file failed to compile.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource compilation failed
C:\Users\bvenh\Documents\flutter\flutter_app_5\build\app\intermediates\incremental\mergeDebugResources\merged.dir\values-de\values-de.xml: AAPT: error: file failed to compile.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource compilation failed
C:\Users\bvenh\Documents\flutter\flutter_app_5\build\app\intermediates\incremental\mergeDebugResources\merged.dir\values-lo\values-lo.xml: AAPT: error: file failed to compile.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource compilation failed
C:\Users\bvenh\Documents\flutter\flutter_app_5\build\app\intermediates\incremental\mergeDebugResources\merged.dir\values-pt\values-pt.xml: AAPT: error: file failed to compile.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource compilation failed
C:\Users\bvenh\Documents\flutter\flutter_app_5\build\app\intermediates\incremental\mergeDebugResources\merged.dir\values-lt\values-lt.xml: AAPT: error: file failed to compile.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource compilation failed
C:\Users\bvenh\Documents\flutter\flutter_app_5\build\app\intermediates\incremental\mergeDebugResources\merged.dir\values-hr\values-hr.xml: AAPT: error: file failed to compile.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource compilation failed
C:\Users\bvenh\Documents\flutter\flutter_app_5\build\app\intermediates\incremental\mergeDebugResources\merged.dir\values-lv\values-lv.xml: AAPT: error: file failed to compile.
* 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 12s
Exception: Gradle task assembleDebug failed with exit code 1
I have tried everything!
And it still does not work.
This is what flutter doctor outputs:
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 1.22.2, on Microsoft Windows [Version 10.0.18362.1139], locale en-NL)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[√] Android Studio (version 4.0)
[√] VS Code (version 1.50.1)
[√] Connected device (1 available)
• No issues found!
I use windows. Old projects do work
So in short, what is the issue?
When I create a new project the default project (and all edits made after that) will result in a mergeDebugResources error, even without making any changes.
Does anyone know how to solve this? Your help would be of major support!
Upvotes: 2
Views: 1364
Reputation: 184
I had same issue with my project and searched for an answer for hours. The solution was actually quite unexpected...
In Windows 10 "Security Options," I turned off the option of ransomware and tried to run the project and it worked. I don't know if this will solve the issue, but consider this as one option if same problem is encountered in future.
Upvotes: 0
Reputation: 1771
It seems it is a Gradle issue. From this thread: https://github.com/flutter/flutter/issues/51690 There is this possible fix posted (updating Gradle version).
In gradle/wrapper/gradle-wrapper.properties
try changing:
https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
to
https\://services.gradle.org/distributions/gradle-5.6.3-all.zip
There is also a stack overflow answer here: https://stackoverflow.com/a/61156603/13714686
Which goes into detail about fixing this issue by changing Gradle settings.
Upvotes: 3