Sunday, November 20, 2016

The command "platforms\android\cordova\clean.bat" exited with code 2. - Visual Studio 2015 - Cordova Apps


I had to deal with this error for months and finally I came up with some sort findings about the root of this error. In my experience there are few possible cases.

If you see this error on your visual studio errors window this is the check list to follow.

Case 1 : Temporary caching  issues in visual studio.

  1. Try to right click the project and rebuild. 
  2. If you cant rebuild the project restart visual studio. Then try again.
  3. If your project is building successfully that means its a temporary caching  problem.

Case 2 : System variables of visual studio not up to date.
  1. Go to tools >> options >>> Tools For Apache Cordova >>> Environment Variable Overrides .
  2. Check all the paths  for your environment variables are correct. If not please apply the correct path.
  3. And try to rebuild the project.

Case 3 : Android SDK is not up to-date.


  1. First delete the andoird folder in platforms folder. 
  2. Try to build your project.
  3. Now you will see more details about the error.
  4. So install or update any component of sdk that has any errors in visual studio error window.


Follow these steps by the above order. That will save you lot of time. 

1 comment: