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

fix(android): strip xmlns definitions from child elements in AndroidManifest.xml #11462

Merged
merged 3 commits into from
Feb 5, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 11 additions & 0 deletions android/cli/lib/android-manifest.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,18 @@ class AndroidManifest {
toString() {
let text = '<?xml version="1.0" encoding="utf-8"?>' + os.EOL;
if (this._xmlDomDocument && this._xmlDomDocument.documentElement) {
// Write XML content to string.
text += this._xmlDomDocument.documentElement + os.EOL;

// Remove all "xmlns:android=<url>"" namespace definitions from child elements.
// Google only allows it in root <manifest/> element or else a build/validation error will occur.
let startReplaceIndex = text.indexOf('<manifest');
if (startReplaceIndex >= 0) {
startReplaceIndex = text.indexOf('>', startReplaceIndex);
text = text.replace(/xmlns:android=".*?"/g, (match, p1) => {
jquick-axway marked this conversation as resolved.
Show resolved Hide resolved
return (p1 <= startReplaceIndex) ? match : '';
});
}
}
return text;
}
Expand Down