-2

I'm newbie here, I have some problem in my script

Hope you guys help me

In this picture, My R script cannot resolve, and My Build failed, and Java Compiler error

enter image description here

This build failed logs

org.gradle.initialization.ReportedException: org.gradle.internal.exceptions.LocationAwareException: Execution failed for task ':app:mergeDebugResources'.
   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
   at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
   at java.lang.Thread.run(Thread.java:745)
Caused by: com.android.build.gradle.tasks.ResourceException: Error: java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT2 error: check logs for details

and this Java Compiler error logs

Error: java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT2 error: check logs for details

FYI

I have done all the ways to solve this problem from various sources such as threads on this web, google, and youtube but all did not work I really hope that some of you will be kind enough to help me solve this problem

Thank You

InsaneCat
  • 2,115
  • 5
  • 21
  • 40
Newbie
  • 7
  • 5
  • The R class is "red" because there was an issue with your resources and therefore it hasn't been generated (it gets generated after resource linking is successful). Once you fix your resources, the R class will be generated again. To find the errors ("check the build log"!) go to the Terminal window and run "gradlew assemble" and update the question with the output. I'll help you solve the errors. – Izabela Orlowska Aug 17 '18 at 10:06
  • I've tried your solution but 2 errors come out `1: Task failed with an exception. ----------- * What went wrong: Failed to capture snapshot of output files for task ':app:mergeReleaseResources' property 'incrementalFolder' during up-to-date check. > Failed to create MD5 hash for file 'C:\Users\yoga\AndroidStudioProjects\Thalia\app\build\intermediates\incremental\mergeReleaseResources\merged.dir\values\values.xml'.` – Newbie Aug 18 '18 at 06:52
  • `2: Task failed with an exception. ----------- * What went wrong: Execution failed for task ':app:mergeDebugResources'. > Error: java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT2 error: check logs for details` – Newbie Aug 18 '18 at 06:53
  • does the file C:\Users\yoga\AndroidStudioProjects\Thalia\app\build\intermediates\incremental\mergeReleaseResources\merged.dir\values\values.xml exist? Can you run "gradlew clean assembleDebug"? – Izabela Orlowska Aug 20 '18 at 11:03

2 Answers2

0

Go to Build option at the top of android studio hit on Rebuild project or clean your project.

After that i hope i will work well.

0

I had the same problem a while ago. Go to Gradle Scripts --> build.gradle (Project: X)

And look for the line

dependencies {
    classpath 'com.android.tools.build:gradle:3.1.3'

I had to replace this line with

dependencies {
    classpath 'com.android.tools.build:gradle:3.2.0-alpha11'

After changing that line I just synced Gradle, which gave me an error and a prompt to download the files. After that it worked like a charm.

Remph
  • 323
  • 1
  • 4
  • 14
  • This my classpath `classpath 'com.android.tools.build:gradle:3.1.4'` and I try your solution but still not working Thanks for your help :) – Newbie Aug 16 '18 at 14:09