Skip to content

feat(android-template): allow HTTP for debug builds#2224

Closed
tlancina wants to merge 2 commits into
masterfrom
feat-debug-allow-http
Closed

feat(android-template): allow HTTP for debug builds#2224
tlancina wants to merge 2 commits into
masterfrom
feat-debug-allow-http

Conversation

@tlancina

@tlancina tlancina commented Dec 5, 2019

Copy link
Copy Markdown
Contributor

This means livereload from localhost will work with no additional
configuration.

This means livereload from localhost will work with no additional
configuration.

@jcesarmobile jcesarmobile left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks but I think we shouldn't enable it by default for debug builds, this will lead to different behaviour in debug and release configs and people not knowing why their connections fail only in release as already happen in Cordova and causes a lot of frustration.

It would be better if we had a new property in the server object of capacitor.config.json that the CLI could read and write this code into the capacitor-cordova-android-plugins module based on it (since it's autogenerated and overwritten by the CLI). Then document that property and also make Ionic CLI write it when using live reload command.

@tlancina

tlancina commented Dec 19, 2019

Copy link
Copy Markdown
Contributor Author

Added it only for localhost, as this is what the starters currently do: https://github.com/ionic-team/starters/blob/master/integrations/cordova/resources/android/xml/network_security_config.xml.

Since a nice out of the box --livereload experience is what I'm going for, there is some work that needs to be done in the CLI to forward the ports as well as some documentation (if you're using --external you'll need to update network_security_config.xml). I feel like this is a good balance between default development experience and not shooting yourself in the foot by having to explicitly opt in to override the network config.

@jcesarmobile

Copy link
Copy Markdown
Member

I've sent a PR with what I proposed, WDYT? #2395

this way, Ionic CLI should have to add this to the capacitor.config.json when doing ionic capacitor run android -l --external

"server": {
    "cleartext": true,
    "url": "http://local.ip.here:8100"
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants