'ERR_CONNECTION_TIMED_OUT error in Ionic

When I try to run 'ionic run android -lc' my app stalls for a while and I get a ERR_CONNECTION_TIMED_OUT on my screen. 'ionic run android' and 'ionic serve' run fine.

I found this post and I added <preference name="phonegap-version" value="3.7.0" /> to my config.xml file and my app already has the whitelist plugin.

net::ERR_CONNECTION_TIMED_OUT error in request from cordova app on real device

I'm still getting the error. Anyone have any idea the problem?

Thanks.



Solution 1:[1]

Please update your node, phonegap and ionic version. And it will works.

Solution 2:[2]

Perhaps you can try one of the following methods:

  1. Type ionic address to ensure that you are using the correct IP. There should be a list to choose from.

  2. Ensure that the android phone is connected to the same WiFi

If error persists, perhaps it is the issue from your computer's antivirus since most of them comes with firewall settings. You might want to disable it and try again. If it works, then the issue is caused by the firewall settings.

Solution 3:[3]

If you are running command

ionic capacitor run android  -l --external

then make sure your device and laptop/pc is on same network.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Hiten
Solution 2 Won YK
Solution 3 Aniket