我试图安装PhoneGap,我得到以下错误:
错误:ANDROID_HOME没有设置,“android”命令不在你的路径中。你必须至少满足其中一个条件。
错误(截图)
我怎么做才能确保Android正确设置为使用Cordova?
我试图安装PhoneGap,我得到以下错误:
错误:ANDROID_HOME没有设置,“android”命令不在你的路径中。你必须至少满足其中一个条件。
错误(截图)
我怎么做才能确保Android正确设置为使用Cordova?
当前回答
对于那些在windows上使用Ionic Framework并且在他们的pc上没有安装Android studio的人,你必须下载Android studio或在列表中下载SDK管理器。
如果你选择SDK管理器选项,你必须设置环境变量的路径:
Variable name: ANDROID_HOME, Variable value: the path where you installed the android SDK, in my case is, C:\Android\android-sdk. You have to add the variable to the Path variable system by adding this: ;%ANDROID_HOME%\platform-tools;%ANDROID_HOME%\tools;. Then if you got the "JDK error" just download it from the Oracle website and create a system variable like the Android SDK: Variable name: JAVA_HOME, Variable value: the path where you installed the JDK, in my case is, C:\Program Files\Java\jdk1.8.0_144. Then add it to the Path variable system by adding ;%JAVA_HOME%\bin. Then if you got the "Gradle error" just fallow the installations steps on the official website of gradle. Finally you can continue to creating your ionic app's apk.
注意:你必须重新打开cmd窗口几次或重新启动你的电脑后做出这些改变。希望这对你有用。
其他回答
Windows:
set ANDROID_HOME=C:\ *installation location* \android-sdk
set PATH=%PATH%;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools
摘自本安装指南。
这主要是丢失的andriod SDK。对于这个问题和“JAVA_HOME”错误跟踪解决方案为我工作…按照以下步骤节省了一整天。
要构建和运行应用程序,您需要为每个目标平台安装sdk。或者,如果你使用浏览器进行开发,你可以使用不需要任何平台sdk的浏览器平台。
检查您是否满足搭建平台的要求:
$ cordova requirements
Requirements check results for android:
Java JDK: installed .
Android SDK: installed
Android target: installed android-19,android-21,android-22,android-23,Google Inc.:Google APIs:19,Google Inc.:Google APIs (x86 System Image):19,Google Inc.:Google APIs:23
Gradle: installed
Requirements check results for ios:
Apple OS X: not installed
Cordova tooling for iOS requires Apple OS X
Error: Some of requirements check failed
我也遇到过同样的问题,我用这个找到了解决方案。
我做了以下步骤:
开放系统属性 环境变量 创建一个新的系统变量 名称:ANDROID_HOME 值:复制您的SDK路径(例如:我的SDK路径E:\SoftWares\Android-SDK)
关闭当前的cmd,并重新启动它 跑扑医生
这应该在Windows上工作
ANDROID_HOME现在已弃用,而不是使用ANDROID_HOME使用ANDROID_SDK_ROOT
根据谷歌android文档-
ANDROID_SDK_ROOT设置SDK安装路径。一旦设置,该值通常不会更改,并且可以由同一机器上的多个用户共享。ANDROID_HOME也指向SDK安装目录,已弃用。
如果你继续使用它,以下规则适用:
如果ANDROID_HOME被定义并且包含一个有效的SDK安装,它的值将被使用而不是ANDROID_SDK_ROOT中的值。 如果ANDROID_HOME没有定义,则使用ANDROID_SDK_ROOT中的值。 如果定义了ANDROID_HOME但不存在或不包含有效的SDK安装,则使用ANDROID_SDK_ROOT中的值。
有关详细信息,请参阅这个Android文档链接
在Windows上使用Android Studio,系统变量设置发生了一些变化。
你仍然需要添加一个系统变量ANDROID_HOME,但是指向包含android SDK的目录,通常安装在C:\Users\YOUR_USERNAME\AppData\Local\ android \android-studio\ SDK。
您还需要向Path系统变量添加以下内容:
% ANDROID_HOME % \平台工具;% ANDROID_HOME % \工具;
摘自:https://github.com/simnova/webdevdocs/wiki/Installing-PhoneGap-and-Android-Studio-on-Windows
SDK路径也在C:\Users\USER\AppData\Local\Android\sdk