2

I created an empty project and added appcompat-v7-26.1.0 support. I'm getting many errors like that:

C:\Users\username.gradle\caches\transforms-1\files-1.1\appcompat-v7-26.1.0.aar\e0aabf040e64856c88683f1511ddf095\res\layout\tooltip.xml: error: file not found.

which lead to:

Error: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details :app:mergeDebugResources FAILED

FAILURE: Build failed with an exception.

What went wrong: Execution failed for task ':app:mergeDebugResources'.

Error: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details

I can solve it by adding property in gradle.properties file

android.enableAapt2=false

... but this is rather workaround than fixing the cause. If you take a look at this missing file path it seems quite long so I was wondering if the path length may be the problem as posted for other issues here. Unfortunately I don't know how can I changed it as most of the length is inside the gradle directory, so even if I change GRADLE_USER_HOME path (C:\Users\username\.gradle in my case) it's not a big profit. I also tried to set

android.enableBuildCache=true # false didn't work as well
android.buildCacheDir =c:\\temp\\

but with no luck. I'd appreciate a helping hand or any tip in this case.

Luke
  • 2,539
  • 2
  • 23
  • 40

3 Answers3

2

Here is what I changed In build.gradle:

dependencies {
    classpath 'com.android.tools.build:gradle:0.4.3'
}

issure here:

https://issuetracker.google.com/issues/36972228

0

I had similar issue.
Changing gradle runtime from Gradle 4.4.1 to Gradle 4.1 helped.
(no changes in dependencies, if you use Jenkins make sure that environment variables updated correctly gradle --version)

0

It looks like the problem is gradle is looking in C:\Users\username.gradle\caches for the cached appcompat libraries. I'm assuming that username.gradle doesn't exist? Or is that a typo?

In any case, I had a similar issue, and specifying the gradle user home directory fixed it. In my case, gradle was looking inside C:\Windows\System32\config\systemprofile, and not finding the cache because it didn't exist.

I set an environment variable for GRADLE_USER_HOME so that gradle would cache things in a set location. See this question for a little more detail.

rorold
  • 326
  • 3
  • 13