1
votes

I have a problem runnig my AwesomeProjecr from react-native.

I run the command: react-native run-android (with physical device), few seconds after I got this error, not the first by the way.

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

java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource compilation failed Output: C:\Windows\System32\AwesomeProject\android\app\build\intermediates\res\merged\debug: error: directory does not exist.

Yes, it does exist.

Command: C:\Users\isai.madueno.gradle\caches\transforms-1\files-1.1\aapt2-3.2.0-alpha18-4804415-windows.jar\f4d1b52455cebe257bb0ea5e72f112ff\aapt2-3.2.0-alpha18-4804415-windows\aapt2.exe compile --legacy \ -o \ C:\Windows\System32\AwesomeProject\android\app\build\intermediates\res\merged\debug \ C:\Windows\System32\AwesomeProject\android\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml

Daemon: AAPT2 aapt2-3.2.0-alpha18-4804415-windows Daemon #2

I used this link before have this new error on the compilling process.

I don´t know what else to do. I tryed a lot but it seems hard to compile.

2
I get weird errors sometimes, I delete the build directory and check your permissions on all the folders within your project (Right Click > Security > Edit > Make sure all are ticked that are tickable) and rebuild your projectJRK

2 Answers

4
votes

The same error occurred to me, I wasted my whole day trying to make it work, uninstalling and reinstalling everything and double checking. However, the solution that worked was:

since the project as default is created in C:\windows\system32 folder, I moved it to a different drive.

And that did the trick. Sys32 folder has its default access permissions that altered the behaviour of gradle and the react-native run-android always ended up with an error. I hope it helps. if anyone can explain the issue more briefly it would help many newcomers. regards

2
votes

This error would happen sometimes on Windows (usually when the input, output or AAPT2 executable were on different drives), but was fixed in recent versions of android gradle plugin 3.3 canaries. Update your build.gradle file to use for example version 3.3.0-alpha10:

buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.0-alpha010'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}