Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
When running the command
cordova platform add android
, I get a bunch of errors popping up in the terminal.
Caelans-MBP:HiltonExtraordinaryFB Caelan$ cordova platform add android
Creating android project...
Creating Cordova project for the Android platform:
Path: platforms/android
Package: com.phonegap.hiltonsimplyfb
Name: Hilton F&B
Android target: android-19
Copying template files...
Project successfully created.
Error: Unexpected close tag
Line: 8
Column: 12
Char: >
at error (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/elementtree/node_modules/sax/lib/sax.js:347:8)
at strictFail (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/elementtree/node_modules/sax/lib/sax.js:364:22)
at closeTag (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/elementtree/node_modules/sax/lib/sax.js:523:7)
at Object.write (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/elementtree/node_modules/sax/lib/sax.js:948:29)
at XMLParser.feed (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/elementtree/lib/parsers/sax.js:48:15)
at ElementTree.parse (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/elementtree/lib/elementtree.js:263:10)
at Object.exports.XML (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/elementtree/lib/elementtree.js:593:13)
at Object.module.exports.parseElementtreeSync (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/util/xml-helpers.js:126:38)
at android_parser.update_from_config (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/metadata/android_parser.js:221:23)
at android_parser.update_project (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/metadata/android_parser.js:349:14)
Caelans-MBP:HiltonExtraordinaryFB Caelan$
Is there any way I can resolve these errors so I can continue.
Without seeing your config.xml
file it's hard to troubleshoot, but I'll bet it's the name of your app:
Name: Hilton F&B
Since config.xml must be valid XML, make sure you're using the &
ampersand entity and not a raw ampersand, which has meaning in XML syntax.
–
I also had the same issue and wanted to share my experience. The problem was Unexpected close tag, in your config.xml file you forgot to close one or two tags, if you look at the line which is shown as error, there is not error even, but somewhre in your config.xml file there is tag not closed. Please, make sure all tags have closed correctly.
–
In my case, I was missing one closing tag in the string that I was parsing to XML. It had a starting tag not closing tag.
Make sure to check all the Tags have starting and closing tags.
If you have XML on runtime and cannot be checked manually, You can use an amazing npm package which provide validate
method to check if XML is valid.
npm link: https://www.npmjs.com/package/fast-xml-parser
example:
const { XMLValidator } = require('fast-xml-parser');
const result = XMLValidator.validate(
"<root>Run the , ...' >/etc/hosts.allow where each <net>/<mask> combination (for example, '192.168.1.0/255.255.255.0') represents one network block in use by your organization that requires access to this system</root>",
allowBooleanAttributes: true,
Just sharing, might be helpful for someone.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.