Ionic-cli: `ionic cordova run android --device` with connected device errors: "ERR_NO_DEVICE: No hardware devices found."

Created on 10 Jun 2019  路  9Comments  路  Source: ionic-team/ionic-cli

Description:
Once updated to Ionic 5.0.1, " ionic cordova run android --device" always got failed. See the error message in Output:

Steps to Reproduce:
just Run ionic cordova run android --device

Output:

BUILD SUCCESSFUL in 6s
42 actionable tasks: 42 up-to-date
Built the following apk(s):
        D:\dev\git\raveneyes\farmers\platforms\android\app\build\outputs\apk\debug\app-debug.apk
> native-run.cmd android --app platforms\android\app\build\outputs\apk\debug\app-debug.apk --device
ERR_NO_DEVICE: No hardware devices found. Not attempting emulator because --device was specified.
[ERROR] An error occurred while running subprocess native-run.

        native-run.cmd android --app platforms\android\app\build\outputs\apk\debug\app-d... exited with exit code 1.

        Re-running this command with the --verbose flag may provide more information.

raven@raven-desk1 MINGW64 /d/dev/git/raveneyes/farmers (master)

My ionic info:

$ ionic info

Ionic:

   Ionic CLI                     : 5.0.1 (C:\Users\raven\AppData\Roaming\npm\node_modules\ionic)
   Ionic Framework               : @ionic/angular 4.3.0
   @angular-devkit/build-angular : 0.13.9
   @angular-devkit/schematics    : 7.2.4
   @angular/cli                  : 7.3.8
   @ionic/angular-toolkit        : 1.4.1

Cordova:

   Cordova CLI       : 9.0.0 ([email protected])
   Cordova Platforms : android 8.0.0
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 3.1.2, (and 16 other plugins)

Utility:

   cordova-res : 0.3.0
   native-run  : 0.2.2

System:

   Android SDK Tools : 26.1.1 (C:\Android\sdk)
   NodeJS            : v10.15.3 (C:\Program Files\nodejs\node.exe)
   npm               : 6.9.0
   OS                : Windows 7

Other Information:
Instead, "native-run android --app " does work!

triage

Most helpful comment

Do you have a hardware device connected? What is the output of adb devices -l?

All 9 comments

Do you have a hardware device connected? What is the output of adb devices -l?

Yes, it is connected!

BUILD SUCCESSFUL in 25s
42 actionable tasks: 2 executed, 40 up-to-date
Built the following apk(s):
        D:\dev\git\raveneyes\farmers\platforms\android\app\build\outputs\apk\debug\app-debug.apk
> native-run.cmd android --app platforms\android\app\build\outputs\apk\debug\app-debug.apk --device
ERR_NO_DEVICE: No hardware devices found. Not attempting emulator because --device was specified.
[ERROR] An error occurred while running subprocess native-run.

        native-run.cmd android --app platforms\android\app\build\outputs\apk\debug\app-d... exited with exit code 1.

        Re-running this command with the --verbose flag may provide more information.

raven@raven-desk1 MINGW64 /d/dev/git/raveneyes/farmers (master)
$ adb devices -l
List of devices attached
adb server is out of date.  killing...
* daemon started successfully *
ELD7N16B19000988       device product:EVA-L09 model:EVA_L09 device:HWEVA


raven@raven-desk1 MINGW64 /d/dev/git/raveneyes/farmers (master)
$

Descri莽茫o:
Uma vez atualizado para o Ionic 5.0.1, "ionic cordova run android --device" sempre falhou. Veja a mensagem de erro na sa铆da:

Passos para reproduzir:
basta executar ionic cordova run android --device

Sa铆da:

BUILD SUCCESSFUL in 6s
42 actionable tasks: 42 up-to-date
Built the following apk(s):
        D:\dev\git\raveneyes\farmers\platforms\android\app\build\outputs\apk\debug\app-debug.apk
> native-run.cmd android --app platforms\android\app\build\outputs\apk\debug\app-debug.apk --device
ERR_NO_DEVICE: No hardware devices found. Not attempting emulator because --device was specified.
[ERROR] An error occurred while running subprocess native-run.

        native-run.cmd android --app platforms\android\app\build\outputs\apk\debug\app-d... exited with exit code 1.

        Re-running this command with the --verbose flag may provide more information.

raven@raven-desk1 MINGW64 /d/dev/git/raveneyes/farmers (master)

Meu ionic info:

$ ionic info

Ionic:

   Ionic CLI                     : 5.0.1 (C:\Users\raven\AppData\Roaming\npm\node_modules\ionic)
   Ionic Framework               : @ionic/angular 4.3.0
   @angular-devkit/build-angular : 0.13.9
   @angular-devkit/schematics    : 7.2.4
   @angular/cli                  : 7.3.8
   @ionic/angular-toolkit        : 1.4.1

Cordova:

   Cordova CLI       : 9.0.0 ([email protected])
   Cordova Platforms : android 8.0.0
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 3.1.2, (and 16 other plugins)

Utility:

   cordova-res : 0.3.0
   native-run  : 0.2.2

System:

   Android SDK Tools : 26.1.1 (C:\Android\sdk)
   NodeJS            : v10.15.3 (C:\Program Files\nodejs\node.exe)
   npm               : 6.9.0
   OS                : Windows 7

Outras informa莽玫es:
Em vez disso, "android nativo --app" funciona!

I was also experiencing this problem after updating CLI to version 5.0.0, it was resolved updated on node as it is commented here

I had the same problem, for me it worked to just remove the --device tag. Ionic thought it was deploying to an emulator but it suddenly popped up on my phone. So I guess ionic just does not recognize if a machine is a hardware device or emulator.

The builds end with the following text before the app deploys to my phone:

BUILD SUCCESSFUL in 6s
42 actionable tasks: 42 up-to-date
Built the following apk(s):
Z:\gitionic\bluetooth.prototype\platforms\android\app\build\outputs\apk\debug\app-debug.apk
native-run.cmd android --app platforms\android\app\build\outputs\apk\debug\app-debug.apk
No hardare devices found, attempting emulator...
Selected emulator 52000390eeb1657b
Installing platforms\android\app\build\outputs\apk\debug\app-debug.apk...
Starting application activity io.ionic.starter/io.ionic.starter.MainActivity...
Run Successful

@winszen Do you have adb installed separately? What is the output of the where adb command? If it is a separate installation, I'm guessing this issue is related to https://github.com/ionic-team/native-run/issues/22, and if so, will be resolved with https://github.com/ionic-team/native-run/issues/22

Yes, also it worked for me without --device. Thank you all!

+1 Same error, same resolution successful

ionic cordova run android

So weird .
My situation is the same as @PurpleEdge2214 .

And according to what SjoerdHaerkens said:

I had the same problem, for me it worked to just remove the --device tag. Ionic thought it was deploying to an emulator but it suddenly popped up on my phone. So I guess ionic just does not recognize if a machine is a hardware device or emulator.

Should this be consider as a bug ?

running_error

native-run android --app not working showing above error

Was this page helpful?
0 / 5 - 0 ratings