How to solve the ‘Execution failed for AarResourcesCompilerTransform’ issue in Android Studio Canary
Recently I was migrating my skeleton MVVM project to Gradle version 4.2.0-alpha13 which I use to start every Android project out there and ran into a peculiar problem. The Android version I am using is:
When building the project I got this error:
Execution failed for task ‘:app:processDebugResources’.
> Could not resolve all files for configuration ‘:app:debugRuntimeClasspath’.
> Failed to transform appcompat-1.2.0.aar (androidx.appcompat:appcompat:1.2.0) to match attributes {artifactType=android-compiled-dependencies-resources, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.libraryelements=aar, org.gradle.status=release, org.gradle.usage=java-runtime}.
> Execution failed for AarResourcesCompilerTransform: C:\Users\xxxxxxxx\.gradle\caches\transforms-2\files-2.1\fde056b080d7a7424f0cc8d58e7acfb1\appcompat-1.2.0.
> AAPT2 aapt2–4.2.0-alpha13–6840111-windows Daemon #1: Daemon startup failed
Please check if you installed the Windows Universal C Runtime.
This should not happen under normal circumstances, please file an issue if it does.
Also Android Studio was showing me this error :
CreateProcess error=740, The requested operation requires elevation.
I immediately knew that the AAPT process could not be started because of an elevation issue.
This is what I tried doing:
- Restart Android Studio Canary.
- Run Android Studio Canary as admin by right clicking the studio64.exe file in the bin folder and choosing ‘Run as administrator’
- Make sure you set compileSdkVersion and targetSdkVersion to 30 in the module build.gradle file.
In the end I restarted my PC thinking that some resources might be freed and AAPT could run freely again using administrative privileges. It worked. The project build again and I could continue working on my project.
Hope this helps somebody.