How to fix "Error - Failed to execute tools\android.bat, error 2 " in Android?

Viewed 43651

When i click on AVD Manager, i am getting an error as in the screenshot below.

Referred to the following links. But none of the solution works for me.

Failed to execute tools\android.bat: solution

Android SDK Windows Failed to execute Android.bat

https://android.stackexchange.com/questions/33538/android-sdk-cant-find-android-bat

In Tools -> Lib Folder i have my AVD Manager.

In Tools -> i have android.bat

I tried the following options and it did not work.

  1. Copied Android SDK Manager in Lib folder and clicked on AVD Manager. Got the same error.
  2. Copied AVD Manager to Tools folder and clicked AVD Manager. Got the same error.

Please find below the error screenshot.

enter image description here

Kindly let me know if any thoughts.

13 Answers

It needs to copy those " SDK Manager.exe " and "AVD Manager.exe" to the SDK root folder, I needed to copy them to C:\android-sdk\ form Lib Folder, this is because, SDK Manager.exe and AVD Manager.exe are looking for tools

This wasn't working for me as I did not have this bat file nor the tools directory at all. And my temp directory did not have any zipped tools directory, so could not just replace.

MS suggested doing repair install

  1. Open the Windows Programs and Features Control Panel.
  2. Right click the relevant Microsoft Visual Studio entry, and select Change
  3. Click the Repair button in the Visual Studio dialog that opens.

That resolved my issue

Happened several times on my environment. @Mahmood and @Qwertie solutions did help, until today.

Banged my head the whole afternoon searching & trying many solutions... finally this one unlocked the situation:

Remove hidden directory C:\Users\{yourUserName}\.android

Related