BLACK TECH
BLACK TECH

Reputation: 21

FAILURE: Build failed with an exception. - Android

AGPBI: {"kind":"error","text":"Android resource linking failed","sources":[{}],"original":"ERROR:: AAPT: D:\android-basics-kotlin-cupcake-app-starter\app\build\intermediates\processed_res\debug\out\resources-debug.ap_: error: The system cannot find the file specified. (2).\nerror: failed to create archive.\n\n ","tool":"AAPT"}

Task :app:mergeDebugNativeLibs Task :app:mergeExtDexDebug

FAILURE: Build failed with an exception.

A failure occurred while executing com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask$TaskAction Android resource linking failed ERROR:: AAPT: D:\android-basics-kotlin-cupcake-app-starter\app\build\intermediates\processed_res\debug\out\resources-debug.ap_: error: The system cannot find the file specified. (2). error: failed to create archive.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0. Use '--warning-mode all' to show the individual deprecation warnings. See https://docs.gradle.org/6.7.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 7s 27 actionable tasks: 26 executed, 1 up-to-date

Can anyone help me to solve this problem...? please...

Upvotes: 1

Views: 361

Answers (1)

CrazyBoyFeng
CrazyBoyFeng

Reputation: 41

This is what happens when aapt fails to create an archive.

First make sure you are using the latest IDE and SDK. aapt for packaging is obsolete, and the earlier aapt2 has many bugs.

If they are up to date, try to check if the following processes on your computer have read/write access to the project directory.

  • [your android sdk path]\build-tools[your sdk version]\aapt.exe
  • [your android sdk path]\build-tools[your sdk version]\aapt2.exe
  • [your android studio path]\bin\studio64.exe
  • [your android studio path]\bin\fsnotifier64.exe
  • [your android studio path]\jre\bin\java.exe
  • [your android studio path]\jre\bin\javaw.exe

If you haven't set permissions manually, they are usually blocked by security software.
I recently ran into this problem and spent a lot of time finally found out that the security software on my workstation was not adding aapt2 and aapt to the allowed list for the project repository.

Upvotes: 0

Related Questions