'Ionic 3 Livereload not working on Android device

In one of my projects where the --livereload flag was working , suddenly the feature is not working but I see Launch Success message on my console.

After launching the app on my android device the Splash screen stays on infinitely and then a message appears as

Application Error
net::ERR_CONNECTION_TIMED_OUT 
(http://192.168 .0.102:8100/)

My config XML has the following :

    <preference name="loadUrlTimeoutValue" value="700000" />
    <preference name="SplashMaintainAspectRatio" value="true" />
    <preference name="SplashScreen" value="screen" />
    <preference name="AutoHideSplashScreen" value="false" />
    <preference name="FadeSplashScreen" value="false" />
    <preference name="SplashScreenDelay" value="300000" />
    <preference name="SplashShowOnlyFirstTime" value="false" />
    <preference name="ShowSplashScreenSpinner" value="true" />

So it specifically mentions loadUrlTimeoutValue as 700000 - but that did not have a positive effect !

Then I added an Inbound Rule to my Windows Firewall to allow specifically the following ports : 8100, 35729, 53703 as these appeared on the console with the following command:

ionic cordova run android --livereload --consolelogs
> ionic-app-scripts serve --address 0.0.0.0 --port 8100 --livereload-port 35729 
--dev-logger-port 53703 --consolelogs --nobrowser --iscordovaserve 
--platform android --target cordova

[app-scripts] [19:00:36]  ionic-app-scripts 3.2.1
[app-scripts] [19:00:36]  watch started ...
[app-scripts] [19:00:36]  build dev started ...
[app-scripts] [19:00:36]  clean started ...
[app-scripts] [19:00:36]  clean finished in less than 1 ms
[app-scripts] [19:00:36]  copy started ...
[app-scripts] [19:00:36]  deeplinks started ...
[app-scripts] [19:00:36]  deeplinks finished in less than 1 ms
[app-scripts] [19:00:36]  transpile started ...
[app-scripts] [19:00:41]  transpile finished in 5.10 s
[app-scripts] [19:00:41]  preprocess started ...
[app-scripts] [19:00:41]  preprocess finished in 1 ms
[app-scripts] [19:00:41]  webpack started ...
[app-scripts] [19:00:41]  copy finished in 5.29 s
[app-scripts] [19:00:45]  webpack finished in 3.63 s
[app-scripts] [19:00:45]  sass started ...
[app-scripts] [19:00:46]  sass finished in 1.00 s
[app-scripts] [19:00:46]  postprocess started ...
[app-scripts] [19:00:46]  postprocess finished in less than 1 ms
[app-scripts] [19:00:46]  lint started ...
[app-scripts] [19:00:46]  build dev finished in 9.92 s
[app-scripts] [19:00:46]  watch ready in 9.98 s

[INFO] Development server running!

This also did not help ..

Finally I added the following permissions to AndroidManifest.xml -

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />

that too did not solve the issue.

I am stuck with the above problem - I will highly appreciate if any fellow devs could get me out of this soup!!

Thanks in advance.

My Ionic Info is as follows:


Ionic:

   ionic (Ionic CLI)  : 4.12.0 
   Ionic Framework    : ionic-angular 3.9.5
   @ionic/app-scripts : 3.2.1

Cordova:

   cordova (Cordova CLI) : not installed
   Cordova Platforms     : android 7.1.4
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.3, 
                           cordova- plugin-ionic-webview 3.1.2, (and 4 other plugins)

System:

   Android SDK Tools : 26.1.1 
   NodeJS            : v8.11.3 
   npm               : 5.6.0
   OS                : Windows 7



Solution 1:[1]

although I didn't face the exactly issue you're having, I also had a hard time trying to run liveload on an Android device with a Ionic 3 project. Below is what I did to solve it.

Installing dependencies

npm cache clean –force

delete node_modules (if it exists)

delete packagelock.js (if it exists)

npm install

Remove cordova platform android with the following command

ionic cordova platforms rm android

Add android platform

ionic cordova platforms add [email protected]

Fixing error

You need to install a cordova plugin to fix the dependency that is missing. You can do so by applying the following command:

cordova plugin add cordova-support-android-plugin

With your android device connected to your pc and both connected on the same Wi-Fi run the following command

ionic cordova run android -l

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 jiujipsu