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
When I do
$ionic run android
In logs says:
No target specified and deploying to emulator
The emulator comes up and has no issues in running the app.
Then I tried
$adb devices -l
Its shows my device XXX
listed there
Now I try running
$ionic run --devices
Its says : Unknown platform : XXX
I tried
$ionic run -d 'XXX'
It throws error
CordovaError: Unknown platform : XXX at cli .....
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?
3条答案
按热度按时间uplii1fm1#
嗨,首先检查目标Android版本的android-manifest.xml文件,如果它是22意味着你需要下载22.0的Android SDK比你的问题将解决
juud5qan2#
对于在andorid设备中运行的write命令:
其中device_id是通过以下方式获得的代码
$ adb device
Reference
希望这对你有帮助
pvcm50d13#
首先确保您已经安装了cordova,在编写本文时最新的版本是8.0.0
$ cordova -v
安装后,连接设备,启用开发人员选项中调试,如果是第一次,可能会要求批准RSA密钥,接受/确认
然后运行命令
$ ionic cordova run android --device
请确保您在环境变量中进行了与android studio相关的路径设置。
使用以下命令可以清除缓存
$ npm cache clean --f