Android net::ERR_CONNECTION_REFUSED (http://192.168.0.107:8080/)
-
I try to debug my app in Android emulator with following comment:
quasar dev -m android
, but the app pop Application Error message:
net::ERR_CONNECTION_REFUSED (http://192.168.0.107:8080/)
I also try to access http://192.168.0.107:8080, also stated that the site cannot be reached.
The terminal have shown this though:
INSTALL SUCCESS
LAUNCH SUCCESSI have checked the Android environment with
cordova requirements
command, no error found. This is the result of this command:Requirements check results for android: Java JDK: installed 1.8.0 Android SDK: installed true Android target: installed android-30,android-29,android-28,android-27,android-25,android-23 Gradle: installed /opt/gradle/gradle-5.3.1/bin/gradle
Can somebody tell me what wrong with it?
-
Could be a couple of different things, all network(lan) related.
You have to set your
host
in quasar.conf underdevServer
to your local dev machine’s ip address? If so then it must be equal to192.168.0.107
, otherwise change it.Any kind of virus scanner => remove completely
Windows firewall? => disable completelyset
https = true
in quasar.conf underdevServer
Does the app work if you use a real phone instead of an emulator?
Does the app work if you run it in
SPA mode
? By running this command:quasar dev
. ( using the your local machines ip address and/or localhost)If all this does not work, please post the output of
quasar info
-
@dobbel said in Android net::ERR_CONNECTION_REFUSED (http://192.168.0.107:8080/):
You have to set your host in quasar.conf under devServer to your local dev machine’s ip address? If so then it must be equal to 192.168.0.107, otherwise change it.
Any kind of virus scanner => remove completely
Windows firewall? => disable completely
set https = true in quasar.conf under devServer
Does the app work if you use a real phone instead of an emulator?
Does the app work if you run it in SPA mode? By running this command: quasar dev. ( using the your local machines ip address and/or localhost)
If all this does not work, please post the output of quasar infoYou have to set your host in quasar.conf under devServer to your local dev machine’s ip address? If so then it must be equal to 192.168.0.107, otherwise change it.
Tried with
host
settings, still doesn’t work.devServer: { https: true, host: '192.168.0.107', port: 8080, open: true // opens browser window automatically },
Above is my devServer.
Any kind of virus scanner => remove completely Windows firewall? => disable completely
I am using ubuntu, and I don’t have such things.
Does the app work if you use a real phone instead of an emulator?
Tried, same error in real device.
Does the app work if you run it in SPA mode? By running this command: quasar dev.
Yes, it works in SPA mode
If all this does not work, please post the output of quasar info
The
quasar info
Operating System - Linux(5.4.0-66-generic) - linux/x64 NodeJs - 12.18.3 Global packages NPM - 7.6.2 yarn - 1.21.1 @quasar/cli - 1.1.3 @quasar/icongenie - Not installed cordova - 10.0.0 Important local packages quasar - 1.15.5 -- Build high-performance VueJS user interfaces (SPA, PWA, SSR, Mobile and Desktop) in record time @quasar/app - 2.2.1 -- Quasar Framework local CLI @quasar/extras - 1.9.19 -- Quasar Framework fonts, icons and animations eslint-plugin-quasar - Not installed vue - 2.6.12 -- Reactive, component-oriented view layer for modern web interfaces. vue-router - 3.2.0 -- Official router for Vue.js 2 vuex - 3.6.0 -- state management for Vue.js electron - Not installed electron-packager - Not installed electron-builder - Not installed @babel/core - 7.13.10 -- Babel compiler core. webpack - 4.44.2 -- Packs CommonJs/AMD modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support loaders to preprocess files, i.e. json, jsx, es7, css, less, ... and your custom stuff. webpack-dev-server - 3.11.0 -- Serves a webpack app. Updates the browser on changes. workbox-webpack-plugin - Not installed register-service-worker - 1.7.1 -- Script for registering service worker, with hooks typescript - 4.2.2 -- TypeScript is a language for application scale JavaScript development @capacitor/core - Not installed @capacitor/cli - Not installed @capacitor/android - Not installed @capacitor/ios - Not installed Quasar App Extensions *None installed* Networking Host - mytc wlp3s0 - 192.168.0.107
Thanks
-
@tc said in Android net::ERR_CONNECTION_REFUSED (http://192.168.0.107:8080/):
Yes, it works in SPA mode
Can you access the app/site using the
192.168.0.107
IP in the browser?If so can you access the app/site from another device(computer / phone ) in your LAN using
192.168.0.107
IP ? -
@dobbel said in Android net::ERR_CONNECTION_REFUSED (http://192.168.0.107:8080/):
192.168.0.107
I can access with
192.168.0.107:8080
. And yes it can accessed by other devices in the same network.For you info my
192.168.0.107
is the localhost which also my nginx php serving ip. So, direct access it without the port will serve the files in the directory.
Don’t know if this relevant.But I have tried with Nativescript, and it works. So maybe it is the cordova thing.
-
@dobbel Finally made it!!
Turns out it is the port wrongly setup in the emulator. It was 8000 by default so change it to 8080 fix this. Or, change the port in in quasar config.
The solution is from here:
https://stackoverflow.com/a/59217370/1310740Anyway, thanks for you help.
-
Great! This was a difficult one