Visual Studio 2015 Apache Cordova Android Build Hangs up

When using Visual Studio 2015 to build an Android Apache Cordova mobile app, the build process does not stop after several minutes and there are no messages on the output window.

This is a sign that the Android SDK Build tools and or other dependencies may not be available on your development machine.  To figure out what is missing from a system, we can enable the MSBuild build output verbosity, or we can run a dependency checker on the Cordova tools.

MSBuild build output verbosity

Visual Studio MSBuild output is usually set in a minimal setting for which the MSBuild events displays are just a few mayor events. In order to view more detail information, we can set the output verbosity to diagnostics. This setting allows Visual Studio to display all the events on the output window which enable us to diagnose problems during the build.

To enable this setting, select the following menu options:

Tools->Options-> Project and Solutions -> MSBuild project build output verbosity drop-down (select Diagnostic).

In case we want to build a project using the command line, we can use the following:

MSBuild.exe MyProject.proj /t:rebuild /verbosity:diagnostic

MSBuild Output Verbosity

We can now build the project again and look at more detail information as well as any errors on missing dependencies.

Dependency checker on the Cordova tools

Visual Studio also has the option to run a dependency checker on the Cordova Tools. This option allows us to see what can be missing from a development machine. To access this option, select the following menu options:

Tools->Options->Tools for Apache Cordova and Click on Run Dependency Checker

Dependency Checker

This should identify missing dependencies like SDK Build tools and other Android packages.

Install missing dependencies

The easy way to install/manage all Android related packages is by using the Android SDK manager. This application allows us to install the latest Android SDK packages and can be downloaded from this location:

Android SDK Manager reference:

Android SDK Manager
The MSBuild output or dependency checker should list the missing components. We can then look for those components and install them using the Android SDK Manager tool. Once the missing components are installed, we can re-start Visual Studio and build the project again.

If all the dependencies are correctly installed, an Android Build for Apache Cordova should now build OK.