Ionic 3部署到设备,设置android_home [英] Ionic 3 deploy to device, set android_home

查看:298
本文介绍了Ionic 3部署到设备,设置android_home的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在ubuntu上安装android studio,并尝试在设备上部署Ionic 3应用程序。

I do install android studio on ubuntu, and try to deploy to device an Ionic 3 app.

它没有说没有找到ANDROID_HOME:

It fails saying no ANDROID_HOME was found :

Failed to find 'ANDROID_HOME' environment variable. Try setting it manually.
Failed to find 'android' command in your 'PATH'. Try update your 'PATH' to include path to valid SDK directory.

我如何才能发现安装Android Sdk的位置?

How can i discover where is Android Sdk installed ?

我知道我可以使用export ANDROID_HOME = / path / to / your / sdk进行设置,但我找不到它来设置路径。

I know i can set using export ANDROID_HOME=/path/to/your/sdk, but i can not find it to set the path.

这是错误消息:
(node:3709)UnhandledPromiseRejectionWarning:未处理的promise拒绝(拒绝id:1):找不到'ANDROID_HOME'环境变量。尝试手动设置。
无法在'PATH'中找到'android'命令。尝试更新PATH以包含有效SDK目录的路径。
(节点:3709)[DEP0018]弃用警告:不推荐使用未处理的拒绝承诺。将来,未处理的承诺拒绝将使用非零退出代码终止Node.js进程。
[23:47:02] lint在4.30秒完成

This is the error message: (node:3709) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Failed to find 'ANDROID_HOME' environment variable. Try setting it manually. Failed to find 'android' command in your 'PATH'. Try update your 'PATH' to include path to valid SDK directory. (node:3709) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. [23:47:02] lint finished in 4.30 s

我只是添加到〜/ .bashrc:export ANDROID_HOME =$ HOME / Android / Sdk
export PATH = $ PATH:$ ANDROID_HOME / tools

I just add to ~/.bashrc : export ANDROID_HOME="$HOME/Android/Sdk" export PATH=$PATH:$ANDROID_HOME/tools

但仍然得到相同的错误消息,我该如何检查路径是否严格?

But still get the same error message, how can i check if the path is rigth?

推荐答案

首先,您需要在实际设备中为run ionic app添加两个路径。 ANDR0ID_HOME和GRADLE_HOME,为此你需要打开etc文件夹中的环境文件,或者尝试这个命令

First of all you need to add two paths for run ionic app in real device. ANDR0ID_HOME and GRADLE_HOME, and for that you need to open your environment file that is in etc folder, or try this command

sudo -H gedit /etc/environment

触发此命令后,gedit打开,将你的ANDROID_HOME路径设置为,

after fire this command, gedit is open, set your ANDROID_HOME path like,

ANDROID_HOME =/ home / android / Sdk /

ANDROID_HOME="/home/android/Sdk/"

和你一样需要设置GRADLE_HOME路径或您还使用; 分隔符将其粘贴到PATH变量中。

and same like this you need to set GRADLE_HOME path or you also paste it into the PATH variable with ; seperator.

在GRADLE_HOME变量中,您需要提供来自android-studio文件夹的gradle路径

In GRADLE_HOME variable you need to provide the gradle path from the android-studio folder

保存并在登录路径后注销。

save it and logged out after logged in your path is set.

登录后,通过输入此命令检查终端是否设置了路径

After Logged in check into your terminal that path is set or not, by typing this command

echo $ANDROID_HOME
echo $PATH

这篇关于Ionic 3部署到设备,设置android_home的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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