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

Order of hostname preference and content in config.xml matters and breaks things #1299

Closed
3 tasks done
AdriVanHoudt opened this issue Jul 28, 2021 · 8 comments · Fixed by #1298
Closed
3 tasks done

Comments

@AdriVanHoudt
Copy link
Contributor

Bug Report

Problem

What is expected to happen?

Setting hostname 'just works' with the content option.

<content src="index.html" />
<preference name="hostname" value="mydomain.com" />

What does actually happen?

The app doesn't load.

Information

The config xml parser sees the content node first and sets the launch url to the default


it then sees the hostname pref and sets it in the prefs.
Afterwards getLaunchUrl is called which then returns the localhost one and not the prefs one.

I think just not doing

if (this.prefs.getBoolean("AndroidInsecureFileModeEnabled", false)) {
launchUrl = "file:///android_asset/www/" + src;
} else {
launchUrl = "https://" + this.prefs.getString("hostname", "localhost") + "/" + src;
}
would make getLaunchUrl reutrn the correct result in all cases.

Command or Code

Config.xml

<content src="index.html" />
<preference name="hostname" value="mydomain.com" />

Environment, Platform, Device

cordova-android 10.x

Version information

Checklist

  • I searched for existing GitHub issues
  • I updated all Cordova tooling to most recent version
  • I included all the necessary information above
@breautek
Copy link
Contributor

We have an open PR that is making changes to this stuff and I think will probably resolve this issue as well: #1298

Can you give that a PR a test to see if it does address your issue?

@erisu
Copy link
Member

erisu commented Jul 28, 2021

This issues was already fixed in the PR that @breautek linked.

@AdriVanHoudt
Copy link
Contributor Author

Jup that seems like it would fix this issue, thanks! 🎉

@AdriVanHoudt
Copy link
Contributor Author

I thought I could get around this by putting the hostname pref before the content but it seems that the config.xml it generates in the android project has a fixed order where the content is always first. Which means that this issue now totally prevents me from having a working build :/
Do you have an ETA on 10.0.2 with the referenced patch in it?

@AdriVanHoudt
Copy link
Contributor Author

Thanks @erisu for merging the fix 🙏
Do you have an ETA on a release that will contain this fix?

@trinitiwowka
Copy link

решение уже в мастере?

@AdriVanHoudt
Copy link
Contributor Author

@trinitiwowka not sure what wizard you mean (could also be Google translate 😅 ) but a fix for this is in 10.1.0.

@trinitiwowka
Copy link

I upgraded from android 8 to 10.1 and for the third day I can't get the app to work.
I get an error: "System UI isn't responding"

Google chrome remote debugger :
"deviceready has not fired after 5 seconds.
Channel not fired: onPluginsReady
Channel not fired: onCordovaReady"

Added a delay. the error does not appear immediately, but appears after 60 seconds.
Снимок экрана 2021-08-26 в 15 19 24

What are the options for solving the problem? Thanks.

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 a pull request may close this issue.

4 participants