简体   繁体   English

“Ionic build android”错误

[英]“Ionic build android” error

I'm new to Ionic and trying to install it using this tutorial . 我是Ionic的新手并尝试使用本教程安装它。

Now everything works, I'm able to create a project and add a platform but when I try to run the command "ionic build android" I get this error: 现在一切正常,我能够创建一个项目并添加一个平台,但当我尝试运行命令“ionic build android”时,我收到此错误:

在此输入图像描述

I ran the ant debug command but it doesn't work. 我运行了ant debug命令,但它不起作用。

I don't have a clue on how to solve this. 我不知道如何解决这个问题。 I tried to reinstall everything, double checked my environment variables and removed and added the android platform again, but nothing works. 我试图重新安装一切,双重检查我的环境变量并删除并再次添加Android平台,但没有任何作用。

I also tried some of the other solutions posted here in some related topics but it seems my error here is still a little bit different. 我也尝试了一些其他相关主题的解决方案,但似乎我的错误仍然有点不同。

I guess it's because you set ANDROID_HOME to the wrong path. 我想这是因为你将ANDROID_HOME设置为错误的路径。

ANDROID_HOME must be set to the root of the android SDK, not to tools folder: ANDROID_HOME必须设置为android SDK的根目录,而不是工具文件夹:

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

(use windows settings to set env vars, don't do it in cmd, that was just to explain more clearly) (使用windows设置设置env vars,不要在cmd中执行,这只是为了更清楚地解释)

Answer Source 答案来源

Just follow this video, you have to set your path correctly. 只需按照此视频,您就必须正确设置路径。

http://learn.ionicframework.com/videos/windows-android/ http://learn.ionicframework.com/videos/windows-android/

1: Download and Install Java then open your system environment variables, and add to or create a new user variable called PATH with the full path to the bin folder of the new Java SDK installation. 1:下载并安装Java然后打开系统环境变量,并添加或创建一个名为PATH的新用户变量,其中包含新Java SDK安装的bin文件夹的完整路径。

2: Download Apache Ant then add the full path to the bin/ folder to the end of your PATH environment variable. 2:下载Apache Ant,然后将bin /文件夹的完整路径添加到PATH环境变量的末尾。

3: Add Android to PATH :Open up your environment variables setting and add the full path to both the adt-bundle/sdk/platform-tools/ folder and the adt-bundle/sdk/tools/ folder to the end of your PATH variable: 3:将Android添加到PATH:打开环境变量设置,并将adt-bundle / sdk / platform-tools /文件夹和adt-bundle / sdk / tools /文件夹的完整路径添加到PATH变量的末尾:

4.Install nodeJs and now you can do 4.安装nodeJs,现在就可以了

 npm install -g cordova ionic

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

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