Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
957 views
in Technique[技术] by (71.8m points)

android - Unable to build Cordova project in Visual Studio

I'm using Visual Studio 2013 and the Cordova CTP 1.1. When I try to build the project, I get the following cryptic error (line breaks added for readability):

Error 22 
The command ""C:UsersNathanAppDataRoaming
pm
ode_modulesvs-mdavs-cli"
prepare --platform Android --configuration Debug
--projectDir . --projectName "servermon"" exited with code 8.
C:UsersNathanAppDataRoaming
pm
ode_modulesvs-mda-targetsMicrosoft.MDA.targets 115 5 servermon

I've tried the solutions from this question as well as this question, and this doesn't appear to solve the issue. My system path appears to have everything relevant in it:

C:Program FilesJavajdk1.7.0_60in
C:UsersNathanAppDataLocalAndroidandroid-sdkools
C:UsersNathanAppDataLocalAndroidandroid-sdkplatform-tools
C:apache-ant-1.9.3in
C:Program Files (x86)NVIDIA CorporationPhysXCommon
C:Windowssystem32
C:Windows
C:WindowsSystem32Wbem
C:WindowsSystem32WindowsPowerShellv1.0
C:Program Files (x86)Windows Kits8.1Windows Performance Toolkit
C:Program FilesMicrosoft SQL Server110ToolsBinn
C:Program Files (x86)Windows LiveShared
C:Program FilesMicrosoftWeb Platform Installer
C:Program Files (x86)
odejs
C:Program Files (x86)Microsoft SDKsTypeScript1.0 

I've also opened up the SDK manager and made sure to get the latest (Rev 19) build tools. The system has been restarted more than once and I'm still not able to build. Does anyone have any ideas on how to fix this build issue?

Edit: Here is a screenshot of my SDK Manager Android SDK Manager

Edit2: Here is the build output

1>------ Build started: Project: servermon, Configuration: Debug Android ------
1>C:Program Files (x86)MSBuildMicrosoftVisualStudiov12.0TypeScriptMicrosoft.TypeScript.targets(90,5): warning : The TypeScript Compiler was given no files for compilation, so it will skip compiling.
1>  Your environment has been set up for using Node.js 0.10.26 (ia32) and npm.
1>  ------ Ensuring correct global installation of package from source package directory: C:Program Files (x86)Microsoft Visual Studio 12.0Common7IDEExtensionsal3uox1v.u2npackagesvs-mda
1>  ------ Build settings:
1>  ------    buildCommand: prepare
1>  ------    platform: Android
1>  ------    cordovaPlatform: android
1>  ------    configuration: Debug
1>  ------    cordovaConfiguration: Debug
1>  ------    projectName: servermon
1>  ------    projectSourceDir: C:UsersNathanDocumentsCordovaTestcordovatestcordovatest
1>  ------ App dir C:UsersNathanDocumentsCordovaTestcordovatestcordovatestldDebug already exists
1>  ------ Copying app files to www
1>  ------ Done copying app files to www
1>  ------ Copying res files
1>  ------ Done copying res files
1>  ------ Platform android already exists
1>  ------ Certificate copy from C:UsersNathanDocumentsCordovaTestcordovatestcordovatest
escertandroid to platformsandroid
1>  ------ Done copying certificate files to platformsandroid
1>  
1>  C:UsersNathanAppDataRoaming
pm
ode_modulesvs-mda
ode_modulesqq.js:126
1>                      throw e;
1>                            ^
1>  CordovaError: The provided path "C:UsersNathanDocumentsCordovaTestcordovatestcordovatestldDebugplatformsandroid" is not an Android project.
1>      at Object.android_parser (C:UsersNathanAppDataRoaming
pm
ode_modulesvs-mda
ode_modulescordovasrcmetadataandroid_parser.js:37:15)
1>      at C:UsersNathanAppDataRoaming
pm
ode_modulesvs-mda
ode_modulescordovasrcprepare.js:51:23
1>      at Array.map (native)
1>      at Object.prepare (C:UsersNathanAppDataRoaming
pm
ode_modulesvs-mda
ode_modulescordovasrcprepare.js:49:35)
1>      at preparePlatform (C:UsersNathanAppDataRoaming
pm
ode_modulesvs-mdaapp.js:322:24)
1>      at _fulfilled (C:UsersNathanAppDataRoaming
pm
ode_modulesvs-mda
ode_modulesqq.js:787:54)
1>      at self.promiseDispatch.done (C:UsersNathanAppDataRoaming
pm
ode_modulesvs-mda
ode_modulesqq.js:816:30)
1>      at Promise.promise.promiseDispatch (C:UsersNathanAppDataRoaming
pm
ode_modulesvs-mda
ode_modulesqq.js:749:13)
1>      at C:UsersNathanAppDataRoaming
pm
ode_modulesvs-mda
ode_modulesqq.js:557:44
1>      at flush (C:UsersNathanAppDataRoaming
pm
ode_modulesvs-mda
ode_modulesqq.js:108:17)
1>C:UsersNathanAppDataRoaming
pm
ode_modulesvs-mda-targetsMicrosoft.MDA.targets(115,5): error MSB3073: The command ""C:UsersNathanAppDataRoaming
pm
ode_modulesvs-mdavs-cli" prepare --platform Android --configuration Debug --projectDir . --projectName "servermon"" exited with code 8.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

It seems the Android template that was downloaded by Cordova is "corrupted".

To fix this: Try deleting the cached android platform in your user directory:

C:users<username>.cordovaandroid*

Then, clean and build the Solution in Visual Studio. Or to be really sure, delete the ‘bld’ directory inside the project folder.

This should force Cordova to re-download the Android template and fix the issue.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...