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?
嗨,首先检查你的目标 android 版本的 android-manifest.xml 文件,如果它是 22 意味着你需要下载 22.0 的 android sdk 比你的问题会解决
For run in andorid device write command:
$ ionic cordova emulate android
$ ionic run android --target=<device_id>
where device_id is the code obtained with
$ adb device
s
Hope this may help you
First make sure you've installed cordova, latest at the time of writing is 8.0.0
$ cordova -v
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
make sure you made path setting with respect to android studio in Environment Variables.
with below command you can clean cache$ npm cache clean --f
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.