I’m having this really annoying problem.
I connect my device (Xiaomi Mi 9) to my Macbook. Than I’m able to do
ionic cordova run android -l
The application starts, I can change the code and see the changes in realtime on the device.
But after about 10 minutes, the pairing notification appear on my device’s screen with the RSA Key (the same that before). From that moment I can’t do anything, my app shows net::ERR_CONNECTION_REFUSED.
I have to remove all permission, disable and enable debug, reconnect the phone and hope to be able to run again.
Often I have to repeat all the operations more times, sometimes works restarting the phone, sometimes I’m not able to restart the application.
This is the console response.
> cordova build android > native-run android --app platforms/android/app/build/outputs/apk/debug/app-debug.apk --forward 8100:8100 [native-run] No hardware devices found, attempting emulator... [native-run] ERR_NO_TARGET: No targets devices/emulators available. Cannot create AVD because there is no suitable API installation. Use --sdk-info to reveal missing packages and other issues. [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 android --app platforms/android/app/build/outputs/apk/debug/app-debug... exited with exit code 1. Re-running this command with the --verbose flag may provide more information.
Why “No hardware devices found” if the first time my phone is detected?
How can I solve this problem?
I can’t lose 15/20 each time!
Thanks in advance.