问题
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
回答1:
I had the same issue. I allowed "Install via USB" in the developer options in my phone which results success
回答2:
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
回答3:
I don't know if is a general solution for this problem, but I solved this cleaning up my phone's storage/memory.
来源:https://stackoverflow.com/questions/57774309/ionic-cordova-run-android-an-error-occured-while-running-subprocess-native-run