1
votes

There is a cordova project developed using Visual Studio - Tools for Apache Cordova (TACo).

While building the project for iOS target, we are able to get the build and debug successfully, on simulator as well on real iOS device.

But while building the same for Android target, it is working with Ripple browser emulators but it is not working with Android emulator or Android real devices.

I have tried updating environment variables manually as well through VS > Tools > Options > Tools for Apache Cordova > Environment Variables Overrides option, which includes

  • ADT_HOME /* This is basically android path */
  • ANT_HOME
  • GIT_HOME
  • JAVA_HOME

I have also verified ANDROID_PATH environment variable value in System Variables, and checked in command prompt using "echo %ANDROID_HOME%", it prints: C:\Program Files (x86)\Android\android-sdk;

VS > Tools > Options > Tools for Apache Cordova > Environment Variables Overrides

Require guidance where should the change is required.

Here is the Build error log:

MSBUILD : cordova-build error : Android SDK not found. Make sure that it is installed. If it is not at the default location, set the ANDROID_HOME environment variable. Android SDK not found. Make sure that it is installed. If it is not at the default location, set the ANDROID_HOME environment variable. (TaskId:10) Done executing task "MdaVsCli" -- FAILED. (TaskId:10)

Done building target "BuildMDA" in project “MyProjectName.jsproj" -- FAILED.: (TargetId:11)

Project Performance Summary: 4704 ms C:\MyProjectDir\MyProjectName.jsproj 1 calls 4704 ms build 1 calls

2
Set your ANDROID_HOME environment variable as suggested in tthe error traceGandhi
@Gandhi : I have updated question with variable details.Mrunal
Have you tried reinstall the android sdk?Elvis Xia - MSFT
@ElvisXia-MSFT: Android SDK been installed along with VS TACo only, how to re-install it separately.Mrunal
@Mrunal Use android sdk manager to install android sdkGandhi

2 Answers

2
votes

The issue was related to Environment Variable only. I used to add semicolon at the end of all the file locations, but for JAVA_HOME, if we add semicolon it is not working with VS TACo.

Hence, i removed the semicolon from the end, and now the JAVA_HOME looks like this:

JAVA_HOME = C:\Program Files (x86)\Java\jdk1.8.0_60

App is now working with Android simulator as well.

0
votes

The recent Android SDK tools removed the android command.

This issue is resolved recently in Cordova. Check out this link for more info on this

You can also downgrade your tools to a version where the android was still available.

Hope it helps