Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: live-reload not working when using adb reverse #4125

Closed
czabaj opened this issue Jan 28, 2021 · 7 comments
Closed

bug: live-reload not working when using adb reverse #4125

czabaj opened this issue Jan 28, 2021 · 7 comments

Comments

@czabaj
Copy link

czabaj commented Jan 28, 2021

Bug Report

App set for live-reload with

	"android": {
		"webContentsDebuggingEnabled": true
	},
	"server": {
		"cleartext": true,
		"url": "http://localhost:8080"
	}

The app runs in the simulator, displays the "Using app server http://localhost:8080" toast, but it serves static assets from the build folder and the live-reload really does not work.

I start the Android studio with

yarn cap sync android && yarn cap copy android && yarn cap open android

Capacitor Version

💊   Capacitor Doctor  💊

Latest Dependencies:

  @capacitor/cli: 2.4.6
  @capacitor/core: 2.4.6
  @capacitor/android: 2.4.6
  @capacitor/electron: 2.4.6
  @capacitor/ios: 2.4.6

Installed Dependencies:

  @capacitor/cli 2.4.5
  @capacitor/core 2.4.5
  @capacitor/ios 2.4.5
  @capacitor/android 2.4.5
  @capacitor/electron not installed

[success] Android looking great! 👌
  Found 9 Capacitor plugins for ios:
    capacitor-dark-mode (1.0.5)
    capacitor-plugin-ios-swipe-back (1.0.3)
    capacitor-rate-app (0.1.1)
    capacitor-secure-storage-plugin (0.5.0)
    cordova-plugin-appcenter-crashes (0.5.1)
    cordova-plugin-appcenter-shared (0.5.1)
    cordova-plugin-fingerprint-aio (4.0.2)
    cordova-plugin-inappbrowser (5.0.0-dev)
    onesignal-cordova-plugin (2.11.2)
[success] iOS looking great! 👌

Platform(s)

Android

Other Technical Details

yarn --version output: 1.22.10

node --version output: v12.19.0

@jcesarmobile
Copy link
Member

see #4123 (comment)

@czabaj
Copy link
Author

czabaj commented Jan 29, 2021

@jcesarmobile oh, I see. Thank you!

Previously, setting localhost worked because we set

adb reverse tcp:8080 tcp:8080

for the simulator or device.

But recently, this stopped working and the fact, that the simulator uses static files from public/ dir instead, cost me a lot of time since it pretends it is working even showing the "Serving from ..." toast.

I set the server to 0.0.0.0 instead of the localhost and now it works again (after the adb reverse ... command).

I like the approach with adb reverse because we can share the server configuration in my team regardless of our network IP and, also, we run locally a mocking API, which we also need to reach on a different port and we can share the API config with web development as well with in-device development if we just adb reverse all the other ports.

I think it would be better when the build with server configuration will fail when the server is unreachable, serving the static files as a fallback is very confusing.

@czabaj
Copy link
Author

czabaj commented Jan 29, 2021

Partially relates #4028

@jcesarmobile
Copy link
Member

if you are using adb reverse tcp:8080 tcp:8080 then it should work

@jcesarmobile jcesarmobile reopened this Jan 29, 2021
@jcesarmobile jcesarmobile changed the title bug: live-reload does not work bug: live-reload does not work when using adb reverse Jan 29, 2021
@jcesarmobile jcesarmobile changed the title bug: live-reload does not work when using adb reverse bug: live-reload not working when using adb reverse Feb 2, 2021
@jcesarmobile
Copy link
Member

closing as the PR was merged, the fix will be available on next release (2.4.7)

@Hamata6
Copy link

Hamata6 commented Mar 3, 2021

@jcesarmobile I'm having the same issue with adb reverse not live reloading. Any idea when 2.4.7 will be released? Thanks for fixing btw
Edit: Sorry for mentioning you, saw too late you prefer not to be pinged

@ionitron-bot
Copy link

ionitron-bot bot commented Nov 11, 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.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Nov 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants