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

9

7

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.

Singlehearted answered 27/9, 2018 at 22:4 Comment(1)
Possible duplicate of Android studio Could not find com.android.tools.build:aapt2:3.2.0-4818971Unnatural
R
10

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.

Rieger answered 17/10, 2018 at 8:55 Comment(0)
L
5

I had the same issue. I resolved it by opening my file browser and navigating to this folder C:\Users\(My User Name)\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar

Opening this folder and viewing its contents, I deleted the folder labeled 81c3666e327fa931c773a52e6cb0b3b7 which for you would be 35960bdffa2420a45dff6ec260c07fa9.

After this I went back to Android Studio and clicked the Build menu, and used the Clean Project option, followed by the Rebuild Project option.

I no longer get this error, or all the debug errors that say the Java package "R" did not exist.

I hope this helps.

Ligamentous answered 25/2, 2019 at 21:24 Comment(2)
Hi @NarwhalGod, please always be mindful to use formatting when posting. This will make your posts more readable.Vingtetun
Many people got this error in Flutter also, it also specifies AndroidX compatibility issues, in reality only this was the issue. This method worked after Googling for hours, thankyou :)Et
I
1

Following solved my issue under jar folder there are 3 folders, one of the folder consists of the aapt2.exe in it. I copied that file to other folder where I am getting error.

ex: path of jar: C:\Users\umabhavania\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar

error path: C:\Users\umabhavania\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\a57a698502c21bfe8cfc3ed6eb102b39\aapt2-3.2.1-4818971-windows

copied aapt2.exe file from 57f15fb82085ec9389484ff7e041344f folder to a57a698502c21bfe8cfc3ed6eb102b39

Hope this helps..

Impanation answered 16/11, 2018 at 7:48 Comment(0)
R
1

I resolved this issue by removing that folder

Go to that path -> Delete

Ex: 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

In this go to "C:\Users\Rémi.gradle\caches\transforms-1\files-1.1\aapt2-3.2.0-4818971-windows.jar\" and delete 35960bdffa2420a45dff6ec260c07fa9

Clean Project and Build

Roderick answered 25/11, 2018 at 3:23 Comment(0)
V
1

Just chnage the gradle version in your build.gradle file in android folder. For example mine was 4.1.0, changed it to 4.1.1

dependencies {
    classpath 'com.android.tools.build:gradle:4.1.1'
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
Vicechancellor answered 24/2, 2022 at 8:46 Comment(0)
D
0

1- enter to the file like

C:\Users\4khalil\.gradle\caches\transforms-1\files-1.1\aapt2-3.3.2-5309881-windows.jar\6abc6a09978228d11497e7ca9c3de2c9\aapt2-3.3.2-5309881-windows

then if you find aapt2.exe.dat, delete the extension .dat to be aapt2.exe and the problem will be solved.

Divorcee answered 5/4, 2019 at 16:18 Comment(0)
D
0

You can use 'invalidate cache and restart'.

In Android Studio, go to File menu -> click Invalidate Caches/Restart.

Dawnedawson answered 27/8, 2020 at 8:1 Comment(0)
A
0

You might need to install Rosetta if on macOS and Apple SoC (M1, M2, M3, M4, ...)

Abdominous answered 24/6 at 15:20 Comment(0)
M
-2

just copy paste this file aap2.exe get it from a friend or somewhere at this location and paste it on the same folder found in yours in .gradle C:\Users\Dina.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\8735df2342ae4ae127451389faa5e1f1\aapt2-3.2.1-4818971-windows\ then build and then the build will complete successful. I didn't know how to attach the file in my answer I am new to stack overflow.

Microdot answered 27/12, 2018 at 8:34 Comment(2)
You can't attach files here on Stack Overflow. You can provide a link to an official source though.Maladroit
Please don't do this! This is very dangerous (since if you download it from an unknown source it might be malware!), instead you should delete the gradle cache folder and let gradle re-download the file for you.Unnatural

© 2022 - 2024 — McMap. All rights reserved.