How to solve Specified AAPT2 executable does not exist on Android Studio 3.2

Rémi De Wispelaere picture Rémi De Wispelaere · Sep 28, 2018 · Viewed 9.4k times · Source

I've an issue with Android Studio. I'm trying to use it on Windows but I've trouble during the project's build process.

First, notice Android Studio is installed on my secondary HDD.

When I try to build/run my project I get this error:

Specified AAPT2 executable does not exist:
C:\Users\Rémi\\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.0-4818971-windows.jar\35960bdffa2420a45dff6ec260c07fa9\aapt2-3.2.0-4818971-windows\aapt2.exe

And indeed there is no aapt2.exe here.

But I've found this .exe here:

H:\Logiciels\AndroidStudioSDK\build-tools\28.0.2\aapt2.exe

and a previous version here:

H:\Logiciels\AndroidStudioSDK\build-tools\27.0.3\aapt2.exe

I've tried to fix this issue by changing the build tools version by setting File > Project structure > Modules > App > Build Tools Version. This option was empty and I chose 28.0.2 but that doesn't change anything.

Thanks for reading.

P.S.: This question is not the same. My error is different and I have google() in my Grable file.

Answer

Mark Sowden picture Mark Sowden · Oct 17, 2018

I solved it by deleting the directory under which it expected the aapt2 executable, e.g. C:\Users\support\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\4c1f5b7dca1d5d378360be7f3fd9726a\aapt2-3.2.1-4818971-windows and then did a clean in Android Studio Build>Clean Project.

Afterwards it appears to have downloaded this again, with the missing executable, and now works perfectly.