在适用于Apache Cordova的工具上针对Android目标构建失败-Visual Studio Professional 2015 [英] Build failing for Android target on Tools for Apache Cordova - Visual studio Professional 2015
问题描述
有一个使用 Visual Studio-Apache Cordova(TACo)的工具开发的cordova项目.
There is a cordova project developed using Visual Studio - Tools for Apache Cordova (TACo).
在为iOS目标构建项目时,我们能够在模拟器以及真实的iOS设备上成功进行构建和调试.
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.
但是在为Android目标构建相同对象时,它可以与Ripple浏览器模拟器一起使用,但不能与Android模拟器或Android真实设备一起使用.
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.
我也尝试通过VS > Tools > Options > Tools for Apache Cordova > Environment Variables Overrides
选项(其中包括
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/*这基本上是android路径*/
- ANT_HOME
- GIT_HOME
- JAVA_HOME
我还验证了系统变量中的ANDROID_PATH环境变量值,并使用"echo%ANDROID_HOME%"在命令提示符下签入,它打印:C:\Program Files (x86)\Android\android-sdk;
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>工具>选项> Apache Cordova的工具>环境变量覆盖
VS > Tools > Options > Tools for Apache Cordova > Environment Variables Overrides
在需要进行更改的地方提供指导.
Require guidance where should the change is required.
这是构建错误日志:
MSBUILD:cordova-build错误:找不到Android SDK.确保已安装.如果它不在默认位置,请设置ANDROID_HOME环境变量. 找不到Android SDK.确保已安装.如果它不在默认位置,请设置ANDROID_HOME环境变量. (TaskId:10) 完成执行任务"MdaVsCli"-失败. (TaskId:10)
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)
在项目"MyProjectName.jsproj"中完成构建目标"BuildMDA"-失败.:(TargetId:11)
Done building target "BuildMDA" in project "MyProjectName.jsproj" -- FAILED.: (TargetId:11)
项目绩效摘要: 4704 ms C:\ MyProjectDir \ MyProjectName.jsproj 1次调用 4704毫秒建立了1个呼叫
Project Performance Summary: 4704 ms C:\MyProjectDir\MyProjectName.jsproj 1 calls 4704 ms build 1 calls
推荐答案
该问题仅与环境变量有关.我曾经在所有文件位置的末尾添加分号,但是对于JAVA_HOME,如果我们添加分号,则它不适用于VS TACo.
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.
因此,我从最后删除了分号,现在JAVA_HOME看起来像这样:
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现在也可以与Android模拟器一起使用.
App is now working with Android simulator as well.
这篇关于在适用于Apache Cordova的工具上针对Android目标构建失败-Visual Studio Professional 2015的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!