java Android phonegap错误:解析XML时出错:未绑定前缀
我重新启动了eclipse,在同一行中,错误更改为“错误:解析XML时出错:未绑定前缀”
我正在尝试在我的安卓 phonegap应用程序中使用this插件。它是一个本地通知插件。我的配置中出现了错误。此行上的xml文件:
<gap:plugin name="de.appplant.cordova.plugin.local-notification" version="0.6.2" />
关于这个问题有一个类似的问题here,但答案与我的问题无关
这是我的配置。xml文件:
<?xml version="1.0" encoding="UTF-8"?>
<widget xmlns = "http://www.w3.org/ns/widgets"
id = "com.xxx.xxx"
version = "2.0.0">
<name>xxx</name>
<description>
xxx
</description>
<author href="http://www.example.com" email="xxx@yahoo.com">
xxx
</author>
<access origin="*"/>
<!-- <content src="xxx" /> for external pages -->
<content src="index.html" />
<preference name="loglevel" value="DEBUG" />
<!--
<preference name="splashscreen" value="resourceName" />
<preference name="backgroundColor" value="0xFFF" />
<preference name="loadUrlTimeoutValue" value="20000" />
<preference name="InAppBrowserStorageEnabled" value="true" />
<preference name="disallowOverscroll" value="true" />
-->
<feature name="App">
<param name="安卓-package" value="org.apache.cordova.App"/>
</feature>
<feature name="Geolocation">
<param name="安卓-package" value="org.apache.cordova.GeoBroker"/>
</feature>
<feature name="Device">
<param name="安卓-package" value="org.apache.cordova.Device"/>
</feature>
<feature name="Accelerometer">
<param name="安卓-package" value="org.apache.cordova.AccelListener"/>
</feature>
<feature name="Compass">
<param name="安卓-package" value="org.apache.cordova.CompassListener"/>
</feature>
<feature name="Media">
<param name="安卓-package" value="org.apache.cordova.AudioHandler"/>
</feature>
<feature name="Camera">
<param name="安卓-package" value="org.apache.cordova.CameraLauncher"/>
</feature>
<feature name="Contacts">
<param name="安卓-package" value="org.apache.cordova.ContactManager"/>
</feature>
<feature name="File">
<param name="安卓-package" value="org.apache.cordova.FileUtils"/>
</feature>
<feature name="NetworkStatus">
<param name="安卓-package" value="org.apache.cordova.NetworkManager"/>
</feature>
<feature name="Notification">
<param name="安卓-package" value="org.apache.cordova.Notification"/>
</feature>
<feature name="Storage">
<param name="安卓-package" value="org.apache.cordova.Storage"/>
</feature>
<feature name="FileTransfer">
<param name="安卓-package" value="org.apache.cordova.FileTransfer"/>
</feature>
<feature name="Capture">
<param name="安卓-package" value="org.apache.cordova.Capture"/>
</feature>
<feature name="Battery">
<param name="安卓-package" value="org.apache.cordova.BatteryListener"/>
</feature>
<feature name="SplashScreen">
<param name="安卓-package" value="org.apache.cordova.SplashScreen"/>
</feature>
<feature name="Echo">
<param name="安卓-package" value="org.apache.cordova.Echo"/>
</feature>
<feature name="Globalization">
<param name="安卓-package" value="org.apache.cordova.Globalization"/>
</feature>
<feature name="InAppBrowser">
<param name="安卓-package" value="org.apache.cordova.InAppBrowser"/>
</feature>
<!-- Deprecated plugins element. Remove in 3.0 -->
<plugins>
<plugin name="SplashScreen" value="org.apache.cordova.SplashScreen"/>
<gap:plugin name="de.appplant.cordova.plugin.local-notification" version="0.6.2" />
</plugins>
</widget>
我正在使用带有adt插件的eclipse。我生成了一个安卓应用程序,并对其进行了一些修改,使其能够与phonegap一起工作(在没有本地通知插件的情况下工作正常)。我使用的是cordova 2.9.0版本。 我怎样才能解决这个问题
# 1 楼答案
您需要添加一个xml名称空间
您的根xml将如下所示:
祝你好运
# 2 楼答案
非常感谢mrmoree!这根线给我指明了正确的方向。我对配置的最终版本也有类似的问题。ionic cordova正在生成xml,出现以下错误:
我必须切换xml标记格式以使
name="android.permission.CAMERA" platform="android"
而不是android:name="android.permission.CAMERA"
正常工作。现在它工作得很好# 3 楼答案
对我来说,问题是在清单文件中有一个不可解释的属性。 将红色标记更改为绿色标记(参见屏幕截图),确保已连接android设备并再次运行
phonegap run android
使用adb logcat发现构建和运行时问题 对于android,您可以使用logcat输出调试phonegap/cordova应用程序。 在iOS上,使用来自xcode的logcat输出
我通过在控制台中从根项目运行
adb logcat
发现了上述问题如果您想过滤任何日志文件的输出,可以使用
grep
后跟关键字(例如error或mergemanifest)轻松完成:用您在logcat中查找的内容替换“error”