Reputation: 195
I am trying to run my ionic app on an android device (Xiaomi Pocophone) by running the following command:
ionic cordova run android
However, I get the following error message:
BUILD SUCCESSFUL in 7s
42 actionable tasks: 42 up-to-date
Built the following apk(s):
C:\laragon\www\ionicProject\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] Selected hardware device 4d65535f
[native-run] Installing platforms\android\app\build\outputs\apk\debug\app-debug.apk...
[native-run] ERR_UNKNOWN: Non-zero exit code from adb: 1
[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.
My phone are properly connected via usb type c cable, developer mode is already turned on and usb debugging mode is turn on
i have tried restarting PC and turn off unrelated IDE such as Laragon
Below are Java JDK 8 installed on my computer, i am using Windows 10 Pro
The Environment Variable system path are as below
Upvotes: 4
Views: 11025
Reputation: 221
First, make sure these 2 options are activated in the developer options.
USB debugging
Install via USB
For Xiaomi devices, you have only 8 seconds to confirm
the installation on your phone. after 8 seconds the installation will be denied automatically and you have to try again.
Upvotes: 0
Reputation: 33
I don't know if it is a general solution for this problem, but I solved this cleaning up my phone's storage/memory.
Upvotes: 0
Reputation: 127
use --verbose parameter in ionic cordova run and get the correct error message, which can range from unauthorized usb use to not enough space on device.
Upvotes: 0
Reputation: 1011
You need to enable both Install via USB and USB debugging in Developer options:
Upvotes: 1
Reputation: 11
I run the command with --verbose and realized its either a problem with not enough storage on the phone or a restriction from the device itself so if you don't have enough space on the phone make sure to make a space on your storage
Upvotes: 0
Reputation: 1
Try :
ionic cordova platform rm android
ionic cordova platform add android
and ionic cordova run android --device
It's work for me !
Upvotes: 0
Reputation: 111
I had the same issue. I allowed "Install via USB" in the developer options in my phone which results success
Upvotes: 11
Reputation: 126
I know it's too late but it might help people in the future. This error is most probably cause by no storage / memory full in phone you are trying to build your apk on. So make some space and try building again.
Check this git issue for the details
Upvotes: 1