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

查看:28
本文介绍了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.

这是错误信息:(节点:3709)UnhandledPromiseRejectionWarning:未处理的承诺拒绝(拒绝ID:1):找不到ANDROID_HOME"环境变量.尝试手动设置.无法在您的PATH"中找到android"命令.尝试更新您的路径"以包含有效 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"导出路径=$PATH:$ANDROID_HOME/工具

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?

推荐答案

首先你需要添加两条路径,以便在真机中运行 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天全站免登陆