简体   繁体   中英

Android Studio 4 build failed cause error=2 no such file or directory

I am new to Android Studio I just opened a template as normal as anybody can do when first open android studio, I didn't edit anything I just tried to build the apk and got that error, can someone help?

Execution failed for task ':app:mergeDebugResources'.
> Multiple task action failures occurred:
   > A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
      > AAPT2 aapt2-4.0.1-6197926-linux Daemon #8: Daemon startup failed
        This should not happen under normal circumstances, please file an issue if it does.
   > A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
      > AAPT2 aapt2-4.0.1-6197926-linux Daemon #6: Daemon startup failed
        This should not happen under normal circumstances, please file an issue if it does.
   > A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
      > AAPT2 aapt2-4.0.1-6197926-linux Daemon #5: Daemon startup failed
        This should not happen under normal circumstances, please file an issue if it does.
   > A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
      > AAPT2 aapt2-4.0.1-6197926-linux Daemon #7: Daemon startup failed
        This should not happen under normal circumstances, please file an issue if it does.
   > A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
      > AAPT2 aapt2-4.0.1-6197926-linux Daemon #12: Daemon startup failed
        This should not happen under normal circumstances, please file an issue if it does.
   > A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
      > AAPT2 aapt2-4.0.1-6197926-linux Daemon #9: Daemon startup failed
        This should not happen under normal circumstances, please file an issue if it does.
   > A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
      > AAPT2 aapt2-4.0.1-6197926-linux Daemon #11: Daemon startup failed
        This should not happen under normal circumstances, please file an issue if it does.
   > A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
      > AAPT2 aapt2-4.0.1-6197926-linux Daemon #10: Daemon startup failed
        This should not happen under normal circumstances, please file an issue if it does.```

Try following options:

  1. clean & rebuild your project
  2. Restart the android studio
  3. Try Invalidate caches and restart
  4. Delete C:\Users\{username}\.gradle\caches folder and restart Android studio
  5. Check and Update your android gradle plugin version

Also check your gradle.properties contain below line or not.

org.gradle.jvmargs=-Xmx4608m

Spent weeks on and off with an AAPT2 error: no such file or directory despite the file concerned being present and not malformed/corrupt (the underlying problem in all the solutions I found online)

I finally discovered that AAPT2 uses the mmap() C library call to map resources into memory for the merge process (AAPT did not.)

My projects were on a network share (SSHFS), which caused an mmap error the AAPT2 code was not expecting, resulting in the inaccurate error message.

The only solutions I could find were:

  1. Don't use a network share (who needs networks right?)

  2. Rewrite AAPT2 to not use mmap.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM