离子运行android不会在设备上运行应用程序 [英] Ionic run android does not run app on device

查看:157
本文介绍了离子运行android不会在设备上运行应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是离子的新手,我正试图在手机上运行离子样本应用程序(三星Galaxy s4 ),我无法这样做。我已在开发者选项中打开USB Debugging

I am new to ionic and I am trying to run a sample app of ionic on my phone (Samsung Galaxy s4) and I am unable to do so. I already have "USB Debugging" on in Developer Options.

如上所示,即使我的手机已连接,它也会在模拟器上运行。该应用程序在模拟器上运行没有问题

As seen above even though my phone is connected it runs on emulator. The app works on emulator without an issue

当我这样做时

$ionic run android

在日志中说:

No target specified and deploying to emulator

模拟器来了up并且在运行应用程序时没有任何问题。

The emulator comes up and has no issues in running the app.

然后我尝试了

$adb devices -l

它显示我的设备XXX 在那里列出

现在我尝试运行

$ionic run --devices

它说:未知平台:XXX

我试过

$ionic run -d 'XXX'

抛出错误

CordovaError: Unknown platform : XXX at cli .....

我甚至试过定义一个指定目标的运行配置文件,但结果是相似的。它在q.js投掷e时抛出错误;

I even tried by defining a run config file specifying the target, however the results are similar. It throws error at q.js throw e;

Target 'XXX' not found, unable to run project.

有人可以告诉我错过了哪一步吗?

Can somebody please advise what step I have missed?

推荐答案

首先确保你已经安装了cordova,在撰写本文时最新版本是8.0.0


$ cordova -v

First make sure you've installed cordova, latest at the time of writing is 8.0.0
$ cordova -v

一旦安装完成,请连接您的设备启用开发人员选项中的调试,如果它是第一次请求批准RSA密钥接受/确定它。

然后运行命令

$ ionic cordova运行android --device

Once it is installed connect your device enable debugging in developer option, if it's first time it might ask approve RSA key accept/ok it.
then run command
$ ionic cordova run android --device

确保你在环境变量中对android studio进行了路径设置。

make sure you made path setting with respect to android studio in Environment Variables.

使用以下命令你可以清理缓存

$ npm缓存清理--f

with below command you can clean cache
$ npm cache clean --f

这篇关于离子运行android不会在设备上运行应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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