Closed IManAsap closed 5 years ago
If you choose to use --no-native-run
with livereload (-l
) and you plan to target a device, then the device and the computer need to communicate with each other somehow. Some people choose to use adb reverse
(see adb docs). Some people use an external address and connect over WiFi (in which case you can use the --address=0.0.0.0
flag). The CLI warns about this potential issue.
Is there a reason you're not using native-run? The tool sets up port forwarding automatically so this wouldn't be an issue.
It's so funny that this issue comes because native-run doesn't work as expected and therefore most people in order to get android emulation/device execution has to add such -no native-run flag on command line. So, it would be nice to have native-run running as it should be in order to avoid ripple effect everywhere.
@fpassa Could you expand on what you think the expected behavior should be?
This issue stems from the fact that livereload is hard. It's hard to get working and hard to conceptualize. There's also a lot of moving parts, because we're actively trying to make it better.
I added this docs issue as a backlog item to expand upon the common gotchas when it comes to using livereload on devices.
I reset my setup
@dwieeb and @IManAsap When I run _#ionic cordova emulate android -l, or run it on my phone, I get same error message:
Application Error net::ERR_CONNECTION_REFUSED (http://localhost:8101/) [ OK ]
Could you explain how did you do it? What tool do you use? What setup file did you change, where is the file? I can’t find it. I am using Visual Studio Code and Android Studio.
Thank you for your help.
I got the same issue https://github.com/ionic-team/ionic-cli/issues/4072#issuecomment-745011762
same issue here Ionic:
Ionic CLI : 6.20.9 (/home/user/.nvm/versions/node/v14.19.1/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/angular 5.9.4
@angular-devkit/build-angular : 0.1000.8
@angular-devkit/schematics : 10.0.8
@angular/cli : 10.0.8
@ionic/angular-toolkit : 2.3.3
Cordova:
Cordova CLI : 11.0.0
Cordova Platforms : android 11.0.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 5.0.0, (and 14 other plugins)
Utility:
cordova-res : 0.15.4
native-run : 1.7.2
System:
Android SDK Tools : 26.1.1 (/home/user/Android/Sdk)
NodeJS : v14.19.1 (/home/user/.nvm/versions/node/v14.19.1/bin/node)
npm : 6.14.16
OS : Linux 5.15
cordova-plugin-ionic-webview 5.0.0
Version:
0.2.7
Description:
I run the ionic cordova run android -l --no-native-run command and the application starts on my device, but the device displays this:
Application Error net::ERR_CONNECTION_REFUSED (http://localhost:8080/) [ OK ]
Command Output:
Windows PowerShell Copyright (C) Microsoft Corporation. Tous droits réservés.
PS C:\Users\christophe\Documents\Mes projets\handicap-tv> ionic cordova run android -l --no-native-run --verbose ionic:lib Terminal info: { ci: false, shell: 'C:\WINDOWS\system32\cmd.exe', tty: true, windows: true } +0ms ionic:lib CLI global options: { _: [ 'cordova', 'run', 'android' ], help: null, h: null, verbose: true, quiet: null, interactive: true, color: true, confirm: null, json: null, l: true, 'native-run': false, project: null, '--': [] } +8ms ionic:lib:project Project type from config: @ionic/angular (angular) +0ms ionic:lib:project Project details: { configPath: 'C:\Users\christophe\Documents\Mes projets\handicap-tv\ionic.config.json', errors: [], context: 'app', type: 'angular' } +1ms ionic Context: { binPath: 'C:\Users\christophe\AppData\Roaming\nvm\v8.11.4\node_modules\ionic\bin\ionic', libPath: 'C:\Users\christophe\AppData\Roaming\nvm\v8.11.4\node_modules\ionic', execPath: 'C:\Users\christophe\Documents\Mes projets\handicap-tv', version: '5.2.1' } +0ms ionic:lib:integrations:cordova:config Loading Cordova Config (config.xml: 'C:\Users\christophe\Documents\Mes projets\handicap-tv\config.xml', package.json: 'C:\Users\christophe\Documents\Mes projets\handicap-tv\package.json') +0ms ionic:lib:integrations:cordova:config Loading Cordova Config (config.xml: 'C:\Users\christophe\Documents\Mes projets\handicap-tv\config.xml', package.json: 'C:\Users\christophe\Documents\Mes projets\handicap-tv\package.json') +115ms ionic:lib:telemetry Sending telemetry for command: 'ionic cordova run' [ 'android', ionic:lib:telemetry '--livereload', ionic:lib:telemetry '--verbose', ionic:lib:telemetry '--interactive', ionic:lib:telemetry '--color' ] +0ms ionic:lib:serve serve options: { '--': [], ionic:lib:serve address: 'localhost', ionic:lib:serve browser: undefined, ionic:lib:serve browserOption: undefined, ionic:lib:serve devapp: false, ionic:lib:serve engine: 'cordova', ionic:lib:serve externalAddressRequired: true, ionic:lib:serve lab: false, ionic:lib:serve labHost: 'localhost', ionic:lib:serve labPort: 8200, ionic:lib:serve livereload: true, ionic:lib:serve open: false, ionic:lib:serve platform: 'android', ionic:lib:serve port: 8100, ionic:lib:serve proxy: true, ionic:lib:serve project: undefined, ionic:lib:serve verbose: false, ionic:lib:serve consolelogs: undefined, ionic:lib:serve consolelogsPort: undefined, ionic:lib:serve ssl: undefined, ionic:lib:serve configuration: undefined, ionic:lib:serve sourcemaps: undefined } +0ms ionic:lib:hooks Looking for ionic:serve:before npm script. +0ms [WARN] An external host may be required to serve for this target device/platform.
ionic:utils-network checking for open port on 0.0.0.0:8100 +0ms ionic:utils-network checking for open port on fe80::6d0d:b4c0:1bec:9:8100 +23ms ionic:utils-network checking for open port on 192.168.106.102:8100 +33ms ionic:utils-network checking for open port on ::1:8100 +41ms ionic:utils-network checking for open port on 127.0.0.1:8100 +143ms ionic:utils-network checking for open port on 0.0.0.0:8101 +99ms ionic:utils-network checking for open port on fe80::6d0d:b4c0:1bec:9:8101 +110ms ionic:utils-network checking for open port on 192.168.106.102:8101 +61ms ionic:utils-network checking for open port on ::1:8101 +92ms ionic:utils-network checking for open port on 127.0.0.1:8101 +64ms ionic:lib:serve Looking for ionic:serve npm script. +727ms
[INFO] Development server running!
ionic:lib:events No process.send, not emitting event serve:ready +0ms ionic:lib:serve serve details: { custom: false, ionic:lib:serve protocol: 'http', ionic:lib:serve localAddress: 'localhost', ionic:lib:serve externalAddress: 'localhost', ionic:lib:serve externalNetworkInterfaces: [], ionic:lib:serve port: 8101, ionic:lib:serve externallyAccessible: false } +9s [WARN] Your device or emulator may not be able to access localhost.
SDK Info:
SDK Location: C:\Android\Sdk AVD Home: C:\Users\christophe.android\avd
API Level: 26 Packages: Android SDK Platform 26 platforms;android-26 2 (!) Missing Packages: Google Play Intel x86 Atom System Image system-images;android-26;google_apis_playstore;x86 /.+/
API Level: 23 Packages: Android SDK Platform 23 platforms;android-23 3 Sources for Android 23 sources;android-23 1
Tools:
Android Emulator emulator 29.0.11 Android SDK Build-Tools 26 build-tools;26.0.0 26.0.0 Android SDK Build-Tools 29 build-tools;29.0.0 29.0.0 Android SDK Platform-Tools platform-tools 29.0.1 Android SDK Tools tools 26.1.1 SDK Patch Applier v4 patcher;v4 1