ANDROID_HOME 未设置且“android"未设置命令不在你的 PATH Phonegap 中 [英] ANDROID_HOME is not set and "android" command not in your PATH Phonegap

查看:26
本文介绍了ANDROID_HOME 未设置且“android"未设置命令不在你的 PATH Phonegap 中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经安装了 android bundle 并且我已经在 .bashrc 文件中配置了所有内容,即使我在命令行中说 android .. 我得到了 android manager .. 但是当我说 ionic platform add android 我总是得到错误为错误:ANDROID_HOME 未设置且android"命令不在您的 PATH 中.您必须至少满足以下条件之一.".我尝试了很多方法,但问题没有解决.

i have installed android bundle and i have configured everything in .bashrc file and even when i say android in command line .. i am getting android manager .. but when i say ionic platform add android i am always getting error as "Error: ANDROID_HOME is not set and "android" command not in your PATH. You must fulfill at least one of these conditions." . i tried many way but issue not fixed .

我的平台:

Ubuntu 14.04 64 位

Ubuntu 14.04 64 bit

.bashrc 文件:

.bashrc file :

    export HOME="/home/system"
    export ANDROID_HOME="$HOME/adt-bundle-linux-x86_64-20140702/sdk/tools"
    export ANDROID_PLATFORM_TOOLS="$HOME/adt-bundle-linux-x86_64-20140702/sdk/platform-tools"
    export PATH="$ANDROID_HOME:$ANDROID_PLATFORM_TOOLS:$PATH"
    export JAVA_HOME="/usr/lib/jvm/java-7-openjdk-amd64"
    export ANT_HOME="/usr/share/ant"
    export PATH="$ANT_HOME/bin:$PATH"
    export ANDROID_HOME="/home/system/adt-bundle-linux-x86_64-20140702/sdk/tools"

执行时出错:

    system@system-H81M-S1:/usr/share/nginx/www/myApp# ionic platform add android
    npm http GET https://registry.npmjs.org/cordova-android/3.6.3
    npm http 200 https://registry.npmjs.org/cordova-android/3.6.3
    npm http GET https://registry.npmjs.org/cordova-android/-/cordova-android-3.6.3.tgz
    npm http 200 https://registry.npmjs.org/cordova-android/-/cordova-android-3.6.3.tgz
    Creating android project...

    /system/.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 /system/.cordova/lib/npm_cache/cordova-android/3.6.3/package/bin/lib/check_reqs.js:158:19
    at _fulfilled (/system/.cordova/lib/npm_cache/cordova-android/3.6.3/package/bin/node_modules/q/q.js:798:54)
    at self.promiseDispatch.done (/system/.cordova/lib/npm_cache/cordova-android/3.6.3/package/bin/node_modules/q/q.js:827:30)
    at Promise.promise.promiseDispatch (/system/.cordova/lib/npm_cache/cordova-android/3.6.3/package/bin/node_modules/q/q.js:760:13)
    at /system/.cordova/lib/npm_cache/cordova-android/3.6.3/package/bin/node_modules/q/q.js:821:14
    at flush (/system/.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: /system/.cordova/lib/npm_cache/cordova-android/3.6.3/package/bin/
    create: Command failed with exit code 8 at ChildProcess.whenDone  (/usr/lib/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)

我可以知道如何解决这个错误

may i know how i can fix this error

推荐答案

我遇到了同样的问题,已经解决了.

I faced the same problem, and it's solved.

我认为这是最新cordova与最新android的兼容性问题.以及您对 android 主路径的问题.

I think it's issue with the compatibility of the latest cordova with latest android. As well as you've issue with the android home path.

在 .bashrc 文件中

export HOME="/home/indranil"
export ANDROID_HOME="$HOME/software/adt-bundle-linux-x86_64-20140702/sdk"
export PATH="$HOME/software/adt-bundle-linux-x86_64-20140702/sdk/tools:$ANDROID_HOME/platform_tools:$PATH"

如果您使用的是旧版本,请尝试下载最新的 android SDK.并从您的 android 管理器下载 Android 4.4.2(API 19).

Try to download the latest android SDK if you're using older version. And download Android 4.4.2(API 19) from your android manager.

您可以使用最新的cordova (4.0.0),但如果问题仍然存在,则使用cordova (3.5.0-0.2.7),但是如果您想升级或降级cordova,请使用删除现有的cordova:-

You can use the latest cordova (4.0.0) but if the issue is still there then use cordova (3.5.0-0.2.7), but if you want to upgrade or downgrade the cordova, remove the existing one using:-

npm uninstall -g cordova  (If linux use sudo npm uninstall -g cordova)

如果您使用的是 linux,请不要使用须藤

If you are using linux don't use sudo

安装cordoava时的commad,如果有报错,运行以下命令

commad at the time of installing cordoava, if you get any error, run the following commands

sudo chown -R `whoami` ~/.npm
sudo chown -R `whoami` /usr/local/lib/node_modules
sudo chown -R `whoami` /usr/local

然后在没有sudo的情况下安装cordova

Then install cordova without sudo

npm install -g cordova@3.5.0-0.2.7

在创建 ionic 应用程序和添加 android 作为平台时不要使用 sudo 命令.Cordova 在添加平台时会在 home 文件夹中创建一个 .cordova 目录.在创建新的离子应用程序之前删除该目录.

At the time of creating ionic app and adding android as platform don't use sudo command. Cordova creates a .cordova directory in the home folder at the time of adding platform. Remove that directory before creating the new ionic application.

下载android(4.4.2)后,使用以下命令创建一个android虚拟设备:

And after downloading the android(4.4.2), create an android virtual device using the command:

android avd

这篇关于ANDROID_HOME 未设置且“android"未设置命令不在你的 PATH Phonegap 中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆