Android Real Device to Test Dev App - Application Error
-
I am having issue to launch my dev app on my Android device, the error messages:
Application Error The connection to the server is unsuccessful
Application Error net:: ERR_CONNECTION_TIMED_OUT (http://<ip address>:8080)
For dev SPA, I can only access it via http://localhost:8080 and not http://<ip address>:8080 on my computer’s Chrome browser. With this clue, I’ve tried to troubleshoot the issue by launching the dev mobile app from:
quasar dev -m android --device
To the following command (with the guidance of Quasar documentation):
quasar dev -m android --device -H localhost -p 8080
However, I’m still getting the errors mentioned on top as the dev app is launching from http://<ip address>:8080, instead of http://localhost:8080?
Any help or advice will be very much appreciated, thanks!
-
In
quasar.conf.js
file you can define your dev machine/host ip address ( and port number).devServer: { // https: true, port: 8080, //host: 'localhost', host: '192.168.2.35', },
-
Hi @dobbel ,
(1) I’ve edited the quasar.conf.js file with the following:
devServer: { https: true, port: 8080, host: 'localhost', open: true },
(2) Deleted the previously built dev cordova app on my Android device.
(3) Rerun the dev command on the PC terminal.
quasar dev -m android --device
(4) But I am still getting the same error on my device.
Application Error net:: ERR_CONNECTION_TIMED_OUT (http://<ip address>:8080)
Please advise what other details I should provide for further troubleshooting purpose, thanks.
ps: Any reason why I can only access the server through localhost but not ip address, is it caused by anti-virus software?
-
You did not do what I told you to do.
For your android device to be able to connect to your host, put under host your dev machine’s local
ip address
instead of localhost:devServer: { // https: true, port: 8080, host: '192.168.30.200', // your local ip adr of YOUR dev machine open: true },
Also be SURE that the
wifi network
of your Android phone’ is thesame
as your dev computer’snetwork
. -
Hi @dobbel
I’ve edited the
quasar.conf.js
accordingly but it’s rendering the same error -Application Error: The connection to the server was unsuccessful.
devServer: { // https: true, port: 8080, host: '<ip address>', // obtained from ipconfig - IPv4 open: true },
Thus, I went ahead to test the dev web app alone by running the
quasar dev
command, the result is as what I’ve mentioned on top, my dev machine cannot serve with<ip address>:8080
butlocalhost:8080
.Kindly advise, thank you!
-
If you cannot connect to your own machine’s local ip4 network address you should solve that first.
-
I’m very new on mobile development, may I know what’s the main cause in general? Is it firewall or anti-virus software?
-
@susansiow yes you need to open up the firewall and the device should be in the same network as your dev machine.
-
Hi @metalsadman
Yes, the computer and Android device are on the same WIFI network.
I’ve been working hard to search for a solution and fix the issue. At my Windows computer, I’ve opened the 8080 port at
Windows Defender Firewall - Inbound Rules
and enabled ‘Internet Connection Sharing Mode’ in my anti-virus program.However, when I run
quasar dev -m android --device
, my Android device will automatically launch the dev app with the same error.
On the contrary, if I run
quasar dev
alone, both of my computer and Android device can see the test app vialocalhost:8080
, which means both can access<host name>:8080
and not<local ip address>:8080
.May I know why the following codes at
quasar.conf.js
and terminal command cannot force the dev app to be launched via localhost:8080?devServer: { port: 8080, host: 'localhost', open: true },
quasar dev -m android --device -H localhost -p 8080
Is there other forcing or redirection methods that I can place in
quasar.conf.js
or apply at the terminal? -
Please remove AVG completely( even just to test) . This is 99,9% the reason why connecting to port 8080 is blocked. “Internet Connection Sharing Mode” is not at all the same as “open all ports”. Btw anti virus is not going to protect you from any modern malware.
Disable windows firewall completely ( unless you are directly connected to the internet without a router).
localhost
is never going to work, even if you see the test app on your android phone. This is becausedev
creates a connection( for debug/hot reload, ect) to your dev machine. -
The latest solution provided by AVG tech team solves the issue -
switch the Network Profile from 'Public' to 'Private'
, thank you! -
Great post, a lot of stuff in here i did not know about