I am building an application that uses Cordova 3.0.0, it is pretty simple but I require adding some plugins in the config.xml file, but whenever I add any plugin lines in the config.xml file, Phonegap Build tells me that the XML is malformed, here is the XML I am using:
我正在构建一个使用Cordova 3.0.0的应用程序,它非常简单,但我需要在config.xml文件中添加一些插件,但每当我在config.xml文件中添加任何插件行时,Phonegap Build都会告诉我XML格式错误,这是我正在使用的XML:
AppName My app description Example Creator
AppName我的应用程序描述示例创建者
<icon src="img/icon.png" />
<gap:plugin name="org.apache.cordova.core.geolocation" />
Whenever I remove the line: everything works, but if that line is there (or a similar line for any plugin whatsoever), I receive the error message (malformed config.xml).
每当我删除该行:一切正常,但如果该行(或任何插件的类似行),我收到错误消息(格式错误的config.xml)。
Any help would be highly appreciated.
任何帮助将受到高度赞赏。
3 个解决方案
#1
7
Was having a similiar issue, and finally found out that the malformed config.xml
is being caused by the gap:plugin
.
有一个类似的问题,并最终发现格式错误的config.xml是由gap:插件引起的。
In my case it was the xml namespace that was defined incorretly. Look at the top of your file, it should be something like:
在我的例子中,它是完全定义的xml命名空间。查看文件的顶部,它应该是这样的:
<?xml version="1.0" encoding="UTF-8" ?>
<widget xmlns = "http://www.w3.org/ns/widgets"
xmlns:gap = "http://phonegap.com/ns/1.0"
id = "com.phonegap.example"
version = "0.0.1" >
Where the important part is having xmlns:gap = "http://phonegap.com/ns/1.0"
, which in my case was only xmlns:cdv="http://cordova.apache.org/ns/1.0"
.
其中重要的部分是xmlns:gap =“http://phonegap.com/ns/1.0”,在我的例子中只有xmlns:cdv =“http://cordova.apache.org/ns/1.0”。
#2
1
I think you are mixing up Cordova calls and Phonegap Build calls. For geolocation, in your Phonegap Build config.xml you need the following:
我想你正在混淆Cordova电话和Phonegap Build电话。对于地理位置,在Phonegap Build config.xml中,您需要以下内容:
<feature name="http://api.phonegap.com/1.0/geolocation"/>
Do NOT put this:
不要这样说:
<gap:plugin name="org.apache.cordova.core.geolocation" />
#3
1
Cordova will actually take care of all the plugin stuff for you as of 3.0.0. Just run cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation.git
from the command line in your project directory.
从3.0.0开始,Cordova实际上将为您处理所有插件。只需运行cordova插件,就可以从项目目录的命令行添加https://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation.git。
Also see the docs on Geolocation here.
另请参阅Geolocation上的文档。
#1
7
Was having a similiar issue, and finally found out that the malformed config.xml
is being caused by the gap:plugin
.
有一个类似的问题,并最终发现格式错误的config.xml是由gap:插件引起的。
In my case it was the xml namespace that was defined incorretly. Look at the top of your file, it should be something like:
在我的例子中,它是完全定义的xml命名空间。查看文件的顶部,它应该是这样的:
<?xml version="1.0" encoding="UTF-8" ?>
<widget xmlns = "http://www.w3.org/ns/widgets"
xmlns:gap = "http://phonegap.com/ns/1.0"
id = "com.phonegap.example"
version = "0.0.1" >
Where the important part is having xmlns:gap = "http://phonegap.com/ns/1.0"
, which in my case was only xmlns:cdv="http://cordova.apache.org/ns/1.0"
.
其中重要的部分是xmlns:gap =“http://phonegap.com/ns/1.0”,在我的例子中只有xmlns:cdv =“http://cordova.apache.org/ns/1.0”。
#2
1
I think you are mixing up Cordova calls and Phonegap Build calls. For geolocation, in your Phonegap Build config.xml you need the following:
我想你正在混淆Cordova电话和Phonegap Build电话。对于地理位置,在Phonegap Build config.xml中,您需要以下内容:
<feature name="http://api.phonegap.com/1.0/geolocation"/>
Do NOT put this:
不要这样说:
<gap:plugin name="org.apache.cordova.core.geolocation" />
#3
1
Cordova will actually take care of all the plugin stuff for you as of 3.0.0. Just run cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation.git
from the command line in your project directory.
从3.0.0开始,Cordova实际上将为您处理所有插件。只需运行cordova插件,就可以从项目目录的命令行添加https://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation.git。
Also see the docs on Geolocation here.
另请参阅Geolocation上的文档。