Android Real Device to Test Dev App - Application Error



  • 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?



  • @susansiow

    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 the same as your dev computer’s network.



  • 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 but localhost:8080.

    Kindly advise, thank you!



  • @susansiow

    If you cannot connect to your own machine’s local ip4 network address you should solve that first.



  • @dobbel

    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.

    screenshot2.png

    However, when I run quasar dev -m android --device, my Android device will automatically launch the dev app with the same error.
    screenshot.png

    On the contrary, if I run quasar dev alone, both of my computer and Android device can see the test app via localhost: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?



  • @susansiow

    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 because dev creates a connection( for debug/hot reload, ect) to your dev machine.



  • @dobbel

    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


Log in to reply