简体   繁体   English

如何在ionic,cordova和android中创建项目?

[英]how to create project in ionic,cordova and android?

I have installed ionic, cordova and android. 我已经安装了ionic,cordova和android。 But ionic is not creating android project. 但是,ionic并没有创建android项目。 I have attached the error. 我已附上错误。

C:\\Users\\shri\\myapp>ionic platform add android Creating android project... C:\\Users\\shri.cordova\\lib\\npm_cache\\cordova-android\\3.6.3\\package\\bin\\node_modules\\q\\q.js:126 throw e; ^ Error: ANDROID_HOME is not set and "android" command not in your PATH. You must fulfill at least one of these conditions. at C:\\Users\\shri.cordova\\lib\\npm_cache\\cordova-android\\3.6.3\\package\\bin\\lib\\check_reqs.js:158:19 at _fulfilled (C:\\Users\\shri.cordova\\lib\\npm_cache\\cordova-android\\3.6.3\\package\\bin\\node_modules\\q\\q.js:798:54) at self.promiseDispatch.done (C:\\Users\\shri.cordova\\lib\\npm_cache\\cordova-android\\3.6.3\\package\\bin\\node_modules\\q\\q.js:827:30) at Promise.promise.promiseDispatch (C:\\Users\\shri.cordova\\lib\\npm_cache\\cordova-android\\3.6.3\\package\\bin\\node_modules\\q\\q.js:760:13) at C:\\Users\\shri.cordova\\lib\\npm_cache\\cordova-android\\3.6.3\\package\\bin\\node_modules\\q\\q.js:821:14 at flush (C:\\Users\\shri.cordova\\lib\\npm_cache\\cordova-android\\3.6.3\\package\\bin\\node_modules\\q\\q.js:108:17) at process._tickCallback (node.js:419:13) at Function.Module.runMain (module.js:499:11) at startup (node.js:119:16) at node.js:906:3 Error: C:\\Users\\shri.cordova\\lib\\npm_cache\\cordova-android\\3.6.3\\package\\bin\\create.bat: Command failed with exit code 8 at ChildProcess.whenDone (C:\\Users\\shri\\AppData\\Roaming\\npm\\node_modules\\cordova\\node_modules\\cordova-lib\\src\\cordova\\superspawn.js:135:23) at ChildProcess.emit (events.js:98:17) at maybeClose (child_process.js:756:16) at Process.ChildProcess._handle.onexit (child_process.js:823:5)

You need to include ANDROID_HOME in your PATH. 您需要在PATH中包含ANDROID_HOME。 I recommend you do the following (assuming you're on Windows 8.1): 我建议您执行以下操作(假设您使用的是Windows 8.1):

Right click the tile launcher icon in your task bar and choose system . 右键单击任务栏中的图块启动器图标,然后选择“ 系统” In the window that pops up, choose Advanced system settings on the left. 在弹出的窗口中,选择左侧的高级系统设置 In the System Properties window click the Environment Variables button and choose to add a new system variable. 在“ 系统属性”窗口中,单击“ 环境变量”按钮,然后选择添加新的系统变量。 For the name choose ANDROID_HOME and for the value include the full path to your Android SDK directory. 对于名称,请选择ANDROID_HOME,对于值,请包含您的Android SDK目录的完整路径。

Edit the PATH variable and add the following to the end of the value: 编辑PATH变量,并将以下内容添加到值的末尾:

;%ANDROID_HOME%\\tools;%ANDROID_HOME%\\platform-tools ;%ANDROID_HOME%\\工具;%ANDROID_HOME%\\平台工具

Restart your windows session and it should work now. 重新启动Windows会话,它现在应该可以工作了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM