question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Android livereload not working

See original GitHub issue

Description of the problem: ionic capacitor run android --livereload launches Android Studio as expected, and it shows up in the emulator when you run in.

However, when you change the web source, for example home.page.html, you can observe that Angular compiles but the app is not updated in the emulator.

[ng] ℹ 「wdm」: Compiling...
[ng] Date: 2019-07-26T11:41:55.215Z - Hash: f7a5c98bae47fab75e0d - Time: 844ms
[ng] 103 unchanged chunks
[ng] chunk {home-home-module} home-home-module.js, home-home-module.js.map (home-home-module) 4.92 kB  [rendered]
[ng] ℹ 「wdm」: Compiled successfully.

I verified by opening a browser and going to http://localhost:8100 that the source has indeed updated, but it is just not reflected in the Android emulator.

What makes it even stranger is that if I open chrome and inspect (chrome://inspect/#devices) and force a reload that way, I can see that the Android emulator reloads, but the changes are not reflected. Maybe some sort of Capacitor webview caching issue?

Here’s steps to reproduce:

  1. git clone https://github.com/biesbjerg/capacitor-android-livereload.git
  2. ionic capacitor run android --livereload
  3. Run in emulator when Android Studio has launched
  4. Make a change to web source

Affected platform

  • Android
  • iOS
  • electron
  • web

OS of the development machine

  • Windows
  • macOS
  • linux

Other information:

Ionic:

   Ionic CLI                     : 5.2.3 (/Users/kim/.npm-global/lib/node_modules/ionic)
   Ionic Framework               : @ionic/angular 4.7.0
   @angular-devkit/build-angular : 0.13.9
   @angular-devkit/schematics    : 7.3.9
   @angular/cli                  : 7.3.9
   @ionic/angular-toolkit        : 1.5.1

Capacitor:

   Capacitor CLI   : 1.1.1
   @capacitor/core : 1.1.1

Utility:

   cordova-res : 0.6.0
   native-run  : 0.2.8

System:

   NodeJS : v10.15.0 (/usr/local/bin/node)
   npm    : 6.10.2
   OS     : macOS Mojave

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jcesarmobilecommented, Jul 26, 2019

The problem is that command is setting the server url to localhost, and that makes to load the local assets.

If you run with ionic capacitor run android -l --address=0.0.0.0 then it will work.

I think Ionic CLI is going to be updated to add the --address=0.0.0.0 as default when the run is targeted to android.

Keeping it open because in #1776 we are trying to workaround this problem too, but have in mind that localhost as live reload server url won’t work on real devices unless you enable port forwarding in chrome inspector.

0reactions
ionitron-bot[bot]commented, Nov 13, 2022

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ionic4 - Capacitor livereload not working - Stack Overflow
Run your project and livereload should work. Make sure that you are connected to the same WiFi on your device and computer. Share....
Read more >
Live reload not working on android - Ionic Forum
both commands only runs live-reload on browser but not in android device,. if i run “ionic cap run android” , this command runs...
Read more >
Capacitor 3 - Android Livereload not working as expected ...
Hi everyone, After upgrading to Capacitor 3 in my Ionic 5 project,live reload on Simulator doesn't work.
Read more >
Live Reload | Capacitor Documentation
Use Live Reload to easily debug the web and native portions of an app on a device or simulator.
Read more >
Livereload not working anymore - Help - Jekyll Talk
It claims LiveReload address: http://0.0.0.0:35729 after the serve command, but I see no reload script injection in my header files. Livereload ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found