Ionic - restarting a non-running application on the device

I do not see my ionic application on my phone when using the --live-reload option.

I am using Windows 8.1 and the connected Nexus 5 Android device. The application is an example of a sidemenu application created using the ionic start demo sidemenu .


When I run ionic run --live-reload , I first get a list of possible IP addresses:

 Multiple addresses available. Please select which address to use by entering its number from the list below: Note that the emulator/device must be able to access the given IP address 1) 192.168.0.109 (Wi-Fi) 2) 192.168.159.1 (VMware Network Adapter VMnet1) 3) 192.168.174.1 (VMware Network Adapter VMnet8) 4) 192.168.56.1 (VirtualBox Host-Only Network) 

I choose option 1 - this is the IP address of my development PC, which hosts the ion server.


Ion confirms this choice and confirms that it serves the ports as shown below:

 Selected address: 192.168.0.109 Running live reload server: http://192.168.0.109:35729 Watching : [ 'www/**/*', '!www/lib/**/*' ] Running dev server: http://192.168.0.109:8100 

I confirmed that it serves the page by opening Chrome on my PC and going to http://192.168.0.109:8100


When the application runs on an Android device, it first displays a splash screen and then shows a web view with an error:

 Web page not available The Web page at http://192.168.0.109:8100/ could not be loaded as: net::ERR_ADDRESS_UNREACHABLE 

This is also reported on the Ionic forums:


As far as I can tell, I opened TCP ports 35729 and 8100 on my Windows machine (using the control panel settings - firewall settings).

What should I configure so that I can see my application on my device?

+11
source share
8 answers

The above configuration was correct.

Ports should be open in the Windows Firewall - but the missing step required a reboot after updating the firewall settings.

After a reboot, everything works correctly.

+7
source

It looks like you are facing a CORS problem.

Install and configure cordova-plugin-whitelist to fix your problem

+3
source

This is probably not a problem for most people, but for me it was because I started the VPN on my phone.

+3
source

Easy, you can use this command in cmd and it works well:

 ionic serve --address 0.0.0.0 
+2
source

I was late for this, but my config.xml created the following line somewhere in my build process:

<content src="http://10.0.0.25:8100" original-src="index.html"/>

I fixed it by changing it to <content original-src="index.html"/> (without src="http://10.0.0.25:8100" )

+1
source

What worked for me (without any changes to project configuration files or firewall settings):

 $ ionic cordova run android -c -l --address=10.0.0.2 (use your local IP address here) 

My setup:

  • My Android phone (running Android 7.1.1) is connected via a USB cable to my Windows desktop computer.
  • The address used is the local IP address for the desktop computer that I received from www.whatismybrowser.com

All the commands that I used to run livereload on my Android phone with the new ionic 3 project:

 $ ionic start testLivereloadProject1 tabs $ cd testLivereloadProject1 $ ionic cordova platform add android $ ionic cordova run android -c -l --address=10.0.0.2 

(-c - console, -l - direct download)

Note. Initially, downloading to the phone was very slow (the splash screen passed, then for some time it was completely white), but after downloading the livereload function worked well.

+1
source

None of the answers above worked for me, I checked which network my phone was connected to and which network my laptop was connected to. Since they were different, I made them connect to the same network, and this solved this problem.

0
source

Check your version of the CLI with ionic information .

Live reboot stopped working for me, as described in the OP, I had to go back to 4.12.0 in order to start it again.

0
source

Source: https://habr.com/ru/post/988796/


All Articles