Home » Android » android – FAILURE: Build failed with exception

android – FAILURE: Build failed with exception

Posted by: admin June 15, 2020 Leave a comment

Questions:
> Executing tasks: [:app:assembleDebug]
> 
> WARNING: The option 'android.enableAapt2' is deprecated and should not
> be used anymore. Use 'android.enableAapt2=true' to remove this
> warning. It will be removed at the end of 2018. :app:preBuild
> UP-TO-DATE :app:preDebugBuild UP-TO-DATE :app:compileDebugAidl
> UP-TO-DATE :app:compileDebugRenderscript UP-TO-DATE
> :app:checkDebugManifest UP-TO-DATE :app:generateDebugBuildConfig
> UP-TO-DATE :app:prepareLintJar UP-TO-DATE
> :app:mainApkListPersistenceDebug UP-TO-DATE
> :app:generateDebugResValues UP-TO-DATE :app:generateDebugResources
> UP-TO-DATE :app:mergeDebugResources FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT error: check logs for details

* 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 13s 9 actionable tasks: 1 executed, 8 up-to-date
How to&Answers:

In gradle.properties change android.enableAapt2=false to true

Answer:

You can actually have problems in the resources but these will not be displayed if you do not correct this problem first:

The option ‘android.enableAapt2’ is deprecated and should not be used
anymore. Use ‘android.enableAapt2 = true’ to remove this warning. It
will be removed at the end of 2018.

within your gradle.properties file that is located in the root of the project, replace:

android.enableAapt2 

with:

android.enableAapt2 = true

Answer:

Try updating your gradle plugin. Fixed my error.

Answer:

within gradle.properties file that is located in the root of the project,

I have just commented on this line, now works perfectly

android.enableAapt2 = true

Answer:

Please make sure that the images and icons you included in your project is Imported by android studio or Drawable importer plugin.

to install this plugin you have to go File>setting> plugin.
then type Drawable importer

Answer:

Your problem is with android.enableAapt2 .
You should check what’s missing or the package is imported correctly.
Search for file android.enableAapt2 or that keyword.