2

trying to develop a simple app for Android device. Have installed android studio 3.1 on Windows 10 machine and trying to build "hello World" app. keep getting error = "Cause: aapt2 is missing on 'C:\Users\xxxxx\AppData\Local\Android\Sdk\build-tools\27.0.3\aapt2.exe'". aapt2.exe is not in the 27.0.3 folder only aapt.exe.

What am I missing? Shouldn't this just work ?

Willy
  • 21
  • 1
  • 3
  • 1
    Looks like some sort of SDK path misconfiguration – Chisko Apr 06 '18 at 16:54
  • Kindly check this link if this help you in any way https://stackoverflow.com/a/46988209/5952645 – sommesh Apr 06 '18 at 17:03
  • 1
    sommesh thanks for the link. unfortunately, does not refer to my issue. does anyone understand why 3.1 is looking for aapt2.exe in the Android\Sdk\build-tools\27.0.3\ folder, but it does not exist. deleting the folder and letting 3.1 re-sync does not create aapt2.exe only aapt.exe – Willy Apr 06 '18 at 18:17
  • Further update. I uninstalled Studio 3.1 and cleaned all android related folders. Then I installed old version 2.3. It runs the hello world app without issue. installed SDK build-tools 25.0.2 and 27.0.3 , and both now contain the aapt2.exe. running compileSdkVersion 25 buildToolsVersion "27.0.3". Now I'm going to try and update the Studio version to 3.1 – Willy Apr 06 '18 at 20:22
  • 1
    As soon as I went back to version 3.1 the issue resurfaced. I'm sticking with version 2.,3 – Willy Apr 09 '18 at 20:22

3 Answers3

2

The SDK manager sometimes messes up when downloading build tools. It's not necessary to re-install Android Studio - just delete the build tools folder/version that's missing the executable and re-download that.

Izabela Orlowska
  • 7,431
  • 2
  • 20
  • 33
  • Never imagined this would ever happen, but indeed it worked. Reinstalling the build tools brought in the missing aapt2 executable. – dllud Dec 21 '19 at 18:01
1

Open File > Project Structure and select app under Modules category from left bar. Then select a higher Build Tools Version from properties tab. The error must be gone.

Saman Salehi
  • 1,995
  • 1
  • 22
  • 36
0

In gradle.properties file put this line: android.enableAapt2=false

It worked with me

Nicola Ben
  • 10,615
  • 8
  • 41
  • 65