离子构建Android错误 [英] ionic build android error
问题描述
我很新的离子型框架,我怎么过已经科尔多瓦和在Windows上运行7系统,但现在我想建立与离子框架Android应用程序,我跟着下面的步骤。
I'm very new to the ionic framework,how ever I've cordova up and running in the windows 7 system but now I'm trying to build an android app with ionic framework and i followed the following steps
>npm install -g cordova
>npm install -g ionic
>ionic start resistance blank
>cd resistance
>ionic platform add android
直到我在这里做得很好,但是当我运行命令
Till here I'm doing good but when I run the command
>ionic build android
我收到以下错误
i get the following error
C:\Users\vishwant\resistance>ionic build android
Running command: "C:\Program Files\nodejs\node.exe" C:\Users\vishwant\resistance\hooks\after_prepare\010_add_platform_class.js C:\Users\vishwant\resis
tance
add to body class: platform-android
Running command: C:\Users\vishwant\resistance\platforms\android\cordova\build.bat
C:\Users\vishwant\resistance\platforms\android\cordova\node_modules\q\q.js:126
throw e;
^
Error: ENOENT, no such file or directory 'C:\adt-bundle-windows-x86_64-20140702\sdk\tools\tools\lib\build.template'
at Object.fs.openSync (fs.js:432:18)
at Object.fs.readFileSync (fs.js:289:15)
at C:\Users\vishwant\resistance\platforms\android\cordova\lib\build.js:120:40
at _fulfilled (C:\Users\vishwant\resistance\platforms\android\cordova\node_modules\q\q.js:798:54)
at self.promiseDispatch.done (C:\Users\vishwant\resistance\platforms\android\cordova\node_modules\q\q.js:827:30)
at Promise.promise.promiseDispatch (C:\Users\vishwant\resistance\platforms\android\cordova\node_modules\q\q.js:760:13)
at C:\Users\vishwant\resistance\platforms\android\cordova\node_modules\q\q.js:574:44
at flush (C:\Users\vishwant\resistance\platforms\android\cordova\node_modules\q\q.js:108:17)
at process._tickCallback (node.js:419:13)
Error: C:\Users\vishwant\resistance\platforms\android\cordova\build.bat: Command failed with exit code 8
at ChildProcess.whenDone (C:\Users\vishwant\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)
我注意到,该路径是不正确的,但在路径变量中我已经设置了正确即到的工具。
I notice that the path is incorrect , but in the path variable I've set up correctly i.e till tools.
错误:ENOENT,没有这样的文件或目录 C:\ ADT-束的Windows x86_64-20140702 \ SDK \工具\工具\ lib目录\ build.template
Error: ENOENT, no such file or directory 'C:\adt-bundle-windows-x86_64-20140702\sdk\tools\tools\lib\build.template'
首先,我不明白为什么它的安装多了一个工具\并搜索build.template 其次,如果我手动创建一个额外的工具\文件夹中的工具\(我想避免),那么这上面的错误是走了,但我会显示在
Firstly,I don't understand why it's attaching one more tools\ and searching for the build.template Secondly, If i manual create that extra tools\ folder inside the tools\ (which i want to avoid) then this above error is gone but i will be shown
C:\Users\vishwant\resistance>ionic build android
Running command: "C:\Program Files\nodejs\node.exe" C:\Users\vishwant\resistance\hooks\after_prepare\010_add_platform_class.js C:\Users\vishwant\resis
tance
add to body class: platform-android
Running command: C:\Users\vishwant\resistance\platforms\android\cordova\build.bat
[Error: Please install Android target "android-19".
Hint: Run "android" from your command-line to open the SDK manager.]
Error: C:\Users\vishwant\resistance\platforms\android\cordova\build.bat: Command failed with exit code 2
at ChildProcess.whenDone (C:\Users\vishwant\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)
既然我已经安装的Android SDK和它工作正常的科尔多瓦项目的目标4.4W,我不明白为什么它的失败的离子框架。
Since I've already installed android sdks and the targets 4.4W which is working fine for the cordova projects, I don't understand why it's failing for the ionic framework.
请纠正我,如果我错过了一些东西。
Please correct me If I'm missing out something.
感谢
推荐答案
我想这是因为你设置ANDROID_HOME了错误的道路。
I guess it's because you set ANDROID_HOME to the wrong path.
ANDROID_HOME必须设置到Android SDK的根,而不是工具文件夹:
ANDROID_HOME must be set to the root of the android SDK, not to tools folder:
SET ANDROID_HOME=C:\adt-bundle-windows-x86_64-20140702\sdk
但这些工具文件夹必须在路径中。
But the tools folder must be in the path.
SET PATH=%PATH%;%ANDROID_HOME%\tools
(当然,使用Windows设置来设置包膜增值经销商,不这样做在cmd中,这仅仅是解释得清楚)
(of course use windows settings to set env vars, don't do it in cmd, that was just to explain more clearly)
这篇关于离子构建Android错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!