我正在使用visual studio 2015与cordova合作。
我创建了简单的项目并将其复制到www
我选择Andriod和Device,然后运行
我收到了错误 你能告诉我如何解决这个问题吗?
1> ------ Building platform: android (TaskId:11)
1> Debug (TaskId:11)
1> ------ Build configuration options: --debug (TaskId:11)
1> Running command: cmd "/s /c ""C:\Users\i053322\Documents\Visual Studio 2015\Projects\BlankCordovaApp2\BlankCordovaApp2\platforms\android\cordova\build.bat" --debug"" (TaskId:11)
1> ANDROID_HOME=C:\Users\i053322\AppData\Local\Android\sdk (TaskId:11)
1> JAVA_HOME=C:\Program Files (x86)\Java\jdk1.7.0_55 (TaskId:11)
1> Running: C:\Users\i053322\Documents\Visual Studio 2015\Projects\BlankCordovaApp2\BlankCordovaApp2\platforms\android\gradlew cdvBuildDebug -b C:\Users\i053322\Documents\Visual Studio 2015\Projects\BlankCordovaApp2\BlankCordovaApp2\platforms\android\build.gradle -Dorg.gradle.daemon=true (TaskId:11)
1> (TaskId:11)
1> FAILURE: Build failed with an exception. (TaskId:11)
1> (TaskId:11)
1> * Where: (TaskId:11)
1> Script 'C:\Users\i053322\Documents\Visual Studio 2015\Projects\BlankCordovaApp2\BlankCordovaApp2\platforms\android\build-extras.gradle' line: 1 (TaskId:11)
1> (TaskId:11)
1> * What went wrong: (TaskId:11)
1> A problem occurred evaluating script. (TaskId:11)
1> > Could not find property 'MissingTranslation' on com.android.build.gradle.internal.dsl.LintOptions_Decorated@2cca98. (TaskId:11)
1> (TaskId:11)
1> * Try: (TaskId:11)
1> Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. (TaskId:11)
1> (TaskId:11)
1> BUILD FAILED (TaskId:11)
1> (TaskId:11)
1> Total time: 11.058 secs (TaskId:11)
1> Picked up _JAVA_OPTIONS: -Xmx512M (TaskId:11)
1> (TaskId:11)
1> C:\Users\i053322\Documents\Visual Studio 2015\Projects\BlankCordovaApp2\BlankCordovaApp2\platforms\android\cordova\node_modules\q\q.js:126 (TaskId:11)
1> throw e; (TaskId:11)
1> ^ (TaskId:11)
1> Error code 1 for command: cmd with args: /s /c ""C:\Users\i053322\Documents\Visual Studio 2015\Projects\BlankCordovaApp2\BlankCordovaApp2\platforms\android\gradlew" cdvBuildDebug -b "C:\Users\i053322\Documents\Visual Studio 2015\Projects\BlankCordovaApp2\BlankCordovaApp2\platforms\android\build.gradle" -Dorg.gradle.daemon=true" (TaskId:11)
1> Command finished with error code 1: cmd /s /c ""C:\Users\i053322\Documents\Visual Studio 2015\Projects\BlankCordovaApp2\BlankCordovaApp2\platforms\android\cordova\build.bat" --debug" (TaskId:11)
1>ERROR building one of the platforms : error : cmd: Command failed with exit code 1
1> You may not have the required environment or OS to build this project (TaskId:11)
1>MDAVSCLI : error : cmd: Command failed with exit code 1
1>Done executing task "MdaVsCli" -- FAILED. (TaskId:11)
1>Done building target "BuildMDA" in project "BlankCordovaApp2.jsproj" -- FAILED.: (TargetId:11)
1>
1>Project Performance Summary:
1> 33454 ms C:\Users\i053322\Documents\Visual Studio 2015\Projects\BlankCordovaApp2\BlankCordovaApp2\BlankCordovaApp2.jsproj 1 calls
1> 33454 ms build 1 calls
1>
1>Target Performance Summary:
1> 0 ms BuildOnlySettings 1 calls
1> 0 ms AfterBuild 1 calls
1> 0 ms BeforeBuild 1 calls
1> 0 ms CoreBuild 1 calls
1> 2 ms CompileTypeScript 1 calls
1> 6 ms PreComputeCompileTypeScript 1 calls
1> 14 ms _CheckForInvalidConfigurationAndPlatform 1 calls
1> 4016 ms InstallMDA 1 calls
1> 4019 ms EnsureNodeJsRequirementsAreAtCorrectVersion 1 calls
1> 29412 ms BuildMDA 1 calls
1>
1>Task Performance Summary:
1> 0 ms AssignTargetPath 1 calls
1> 1 ms MdaVerifySetup 1 calls
1> 2 ms Message 2 calls
1> 6 ms VsTsc 2 calls
1> 17 ms CreateBuildInfoMetadata 1 calls
1> 4015 ms RunMdaInstall 1 calls
1> 4017 ms CallTarget 1 calls
1> 29393 ms MdaVsCli 1 calls
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:33.42
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
========== Deploy: 0 succeeded, 0 failed, 0 skipped ==========
答案 0 :(得分:1)
您是否使用Visual Studio安装了Cordova / Taco?
当你说"我创建了简单的项目并将其复制到www"让我感到疑惑的是,如果项目是由Visual Studio 2015创建的,那就不需要了。当你在VS中创建一个新项目时,它会为你提供" Cordova项目的选项吗?"
如果您使用VS安装,似乎某些东西已经破坏了与VS工具的链接(此错误:"您可能没有必要的环境或操作系统来构建此项目")。下载路径编辑器2(下面的链接)并确保您的路径中没有任何无效条目。
确保您使用VS安装程序安装了2015年安装了Cordova工具的Update 3。这将确保您拥有正确的android sdk和工具链来进行构建。
如果您使用VS安装,则可能需要运行android SDK管理器并安装更新的软件包。