Deploying to a Device

Hi,
I am new to ionic framework so please pardon my ignorance. I have developed simple(POC) ionic app and trying to test it on my android device.
I was following the deployment tutorial


When I try to run the app as per the tutorial I get the following error.

cmd> ionic run android --device
The run command has been renamed. To find out more, run:

ionic cordova run --help

When i run the suggested command I recieve different error.
cmd>ionic cordova run --help
[ERROR] Unable to find command: cordova run

Can someone please help? I want to know how do I test the app on an android device.

Updated ionic info

cmd>ionic info

global packages:

@ionic/cli-utils : 1.3.0
Ionic CLI        : 3.3.0

local packages:

@ionic/app-scripts              : 1.3.7
@ionic/cli-plugin-ionic-angular : 1.3.0
Ionic Framework                 : ionic-angular 3.3.0

System:

Node       : v6.9.4
OS         : Windows 7
Xcode      : not installed
ios-deploy : not installed
ios-sim    : not installed

Thanks

Please post your ionic info output. Thanks.

updated the message with ionic info

What happens if you add the Android platform? ionic cordova platform add android

I was able to successfully add android platform.

I had couple of hiccups running
cmd> ionic cordova build android

I was able to solve those issues too.

Now I am back to running
cmd> ionic cordova run android --device

lots of output and at the end this is the error

ANDROID_HOME=C:\Program Files (x86)\Android\android-sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_66
Error: Failed to deploy to device, no devices found.

[ERROR] Cordova encountered an error.
** You may get more insight by running the Cordova command above directly.**

[ERROR] An error occurred while running cordova run android --device (exit code 1).

What am I doing wrong?

Thanks for your help.

Seems you have no device connected to your computer… (Run Android Studio to add emulators)

try adb devices -l, this wil show a list of connected devices. If your device is not listed, ionic will not be able to deploy on your device. More information can be found in this link

https://developer.android.com/studio/command-line/adb.html

Make sure latest driver is installed and usb debuggin is enabled on your phone.

1 Like

If the adb devices -l command does not list your device, try a different USB cable.
This fixed the issue for me.

Make sure to allow USB debugging in developer options inside your device, that solved the issue for me.

1 Like

Hello!
I have the same problem, it worked normally and just stopped.
Adb devices shows the emulator.
I am using the Android Studio emulator.
Any tips?

I resolved by removing “–device” from the command “ionic cordova run android --device --no-native-run”