I’m working on a relatively new Ionic Angular project, and as far back as the first run, I’ve had an issue with running on an Android Emulator from the command line.
the specific command I’m using is
ionic cordova emulate android --ssl --livereload --external, where:
- I need
--sslbecause I’m working with Push Notifications.
- I’ve never managed to get the app to connect to my dev server without
this command is defined in my
android, allowing me to run it by simply calling
npm run android.
on the first run after starting up my machine, sometimes the process will simply stop at the
cordova.exe build android --emulator command. no emulator launches and absolutely nothing more is printed to console… I’ve left it for upwards of 30 minutes before, and still nothing.
if the native binary build command does actually run (or if I ctrl+c to kill it), the next run always gets past this point and launches the emulator.
one minor caveat to this: if I run
--verbose, then this first step never fails, but that’s the only difference.
on the next run, it will always get through the native binary build and start my emulator, but then when it tries to launch my app in the emulator, I’m greeted with a
net::ERR_CONNECTION_REFUSED (https://0.0.0.0:8100/) error, and tapping “OK” simply closes the app, leaving me to run the process from the start again.
checking the console output, it almost always states that the ADB server is not responding, moving on to kill and restart it.
on the next run, it will sometimes give me the same
net::ERR_CONNECTION_REFUSED message, but more often this time does work. recurring issues play out exactly as described in the previous step.
a few notes on my environment:
- OS: Windows 10 Pro 21H2, build 19044.1706
- Console: PowerShell 7.2.3, accessed through Windows Terminal Preview 1.13.10983.0
email@example.com, installed and activated through Jabba
14.19.2, installed and activated through Volta
Ionic: Ionic CLI : 6.19.0 (C:\Users\agreeff\AppData\Local\Volta\tools\image\packages\@ionic\cli\node_modules\@ionic\cli) Ionic Framework : @ionic/angular 6.1.1 @angular-devkit/build-angular : 13.3.3 @angular-devkit/schematics : 13.3.3 @angular/cli : 13.3.3 @ionic/angular-toolkit : 6.1.0 Cordova: Cordova CLI : 11.0.0 Cordova Platforms : android 10.1.2 Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 5.0.0, cordova-plugin-ionic 5.5.2, (and 4 other plugins) Utility: cordova-res : 0.15.4 native-run : 1.5.0 System: Android SDK Tools : 26.1.1 (C:\android-sdk) NodeJS : v14.19.2 (C:\Users\agreeff\AppData\Local\Volta\tools\image\node\14.19.2\node.exe) npm : 6.14.17 OS : Windows 10
NOTE: I had to run
volta run --node 14.19.2 ionic info to get this output. for some unknown reason, Volta keeps running this in
14.19.1, even though the project is pinned to
I also just tried
volta run --node 14.19.2 ionic doctor check, and that tells me to uninstall
@ionic/cli from the local project… but it’s not installed locally.
completely random thought, but could this just be Volta messing with things that Ionic CLI doesn’t expect? I work on many different Node projects, some of which require specific runtime versions (similar case for Java, hence my usage of Jabba as well).