Issue
The Connected Device:
It is running Developer Options with USB debugging enabled
It is using MTP as the Device file manager
Drivers have been installed to the laptop with no issues and I can browse the files fine
When I run: ionic cordova run android --device
I get this output:
BUILD SUCCESSFUL in 5s
42 actionable tasks: 42 up-to-date
Built the following apk(s):
C:\Users\K-PC\myApp\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
[native-run] ERR_NO_DEVICE: No hardware devices found. Not attempting emulator because --device was specified.
[native-run]
[native-run] More details for this error may be available online:
[native-run]
[native-run] https://github.com/ionic-team/native-run/wiki/Android-Errors
[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.
I checked to see if the device was listed using native-run android --list
and I get this output:
Errors (!):
ERR_UNSUITABLE_API_INSTALLATION: No suitable API installation found.
More details for this error may be available online:
https://github.com/ionic-team/native-run/wiki/Android-Errors
Connected Devices:
No connected devices found
Virtual Devices:
No virtual devices found
I have Android Studio installed, I have two virtual devices in my AVD manager:
I want to deploy the APK onto the device connected to my laptop, not these emulators but its strange to see that it hasn't even recognised the emulators inside my AVD manager
How can I fix this issue? I hope I have given enough detail.
Solution
Using ADB
adb devices
That command should give you a list of the attached devices. You must accept the debug mode on the phone. Before trying to run the app with a hardware device you should check that adb has a connection with one device atleast.Some issues may appear like:
- List of devices are empty: That means that the device is either not properly connected or there's an issue with the USB cable(may be broken).
- Unauthorized: Appears when you didn't accept the debug authorization of your phone.
- Offline: The phone has a little service called daemon that allows it to connect with the computer so can transfer the files and listen to changes. When this service is not running it stops the connection with the computer. Can be solved by rebooting the device or connect/disconnect the USB cable until it can be shown as "online".
In summary you should run this code:
- Enable Debug mode on your Android device. Also enable USB debug that is in the same configuration view.
- Run
adb devices
, Authorize to connect with the computer. Solve the issues(if there's any) already commented above. - Run
ionic cordova run android --device
. - Happy coding time!.
Answered By - Jo Carrasco
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.