带有 Cordova 默认应用程序 XML 错误的 Eclipse THyM
Posted
技术标签:
【中文标题】带有 Cordova 默认应用程序 XML 错误的 Eclipse THyM【英文标题】:Eclipse THyM with Cordova default application XML errors 【发布时间】:2017-01-01 17:12:55 【问题描述】:我目前正在使用Cordova
,刚开始想知道我是否可以从我的Eclipse Neon
开发。
下载最新的JBoss tools
并将它们安装在我的 javascript Eclipse Neon 上,这样我就可以使用新的 Hybrid 移动开发功能。
使用新项目向导创建了一个默认的混合移动 (Cordova) 应用程序项目。添加 android 平台 (cordova-android@5.2.2
)。
Eclipse 构建并配置了新项目,但出现了一些关于 XML 验证的错误。我可以在我的 android 设备或 cordova 模拟器上运行这个示例应用程序。它运行并显示 OK,但 Eclipse 代码上仍然标记错误。
这些是我得到的错误:
cvc-attribute.3: The value 'loglevel' of attribute 'name' on element 'preference' is not valid with respect to its type, 'null'. defaults.xml /Test/platforms/android/cordova line 25 XML Problem
cvc-enumeration-valid: Value 'loglevel' is not facet-valid with respect to enumeration '[AllowInlineMediaPlayback, AndroidLaunchMode, android-maxSdkVersion, android-targetSdkVersion, AppendUserAgent, BackgroundColor, BackupWebStorage, ChildBrowser, CordovaWebViewEngine, DefaultVolumeStream, DisallowOverscroll, EnableViewportScale, EnableWebGL, ErrorUrl, FullScreen, GapBetweenPages, HideKeyboardFormAccessoryBar, HideMousePointer, InAppBrowserStorageEnabled, KeepRunning, KeyboardDisplayRequiresUserAction, LoadUrlTimeoutValue, LoadingDialog, LogLevel, MediaPlaybackAllowsAirPlay, MediaPlaybackRequiresUserAction, Min/Max Version, Orientation, OSXLocalStoragePath, OverrideUserAgent, PageLength, PaginationBreakingMode, PaginationMode, PopupBlocker, SetFullscreen, ShowTitle, Suppresses3DTouchGesture, SuppressesIncrementalRendering, SuppressesLongPressGesture, TopActivityIndicator, UIWebViewDecelerationSpeed, WebSecurity, WindowSize, WindowsDefaultUriPrefix, WindowsStoreDisplayName, WindowsStoreIdentityName, WindowsStorePublisherName, WindowsToastCapable, deployment-target, target-device, windows-phone-target-version, windows-target-version]'. It must be a value from the enumeration. defaults.xml /Test/platforms/android/cordova line 25 XML Problem
cvc-attribute.3: The value 'loglevel' of attribute 'name' on element 'preference' is not valid with respect to its type, 'null'. config.xml /Test/platforms/android/res/xml line 22 XML Problem
cvc-enumeration-valid: Value 'loglevel' is not facet-valid with respect to enumeration '[AllowInlineMediaPlayback, AndroidLaunchMode, android-maxSdkVersion, android-targetSdkVersion, AppendUserAgent, BackgroundColor, BackupWebStorage, ChildBrowser, CordovaWebViewEngine, DefaultVolumeStream, DisallowOverscroll, EnableViewportScale, EnableWebGL, ErrorUrl, FullScreen, GapBetweenPages, HideKeyboardFormAccessoryBar, HideMousePointer, InAppBrowserStorageEnabled, KeepRunning, KeyboardDisplayRequiresUserAction, LoadUrlTimeoutValue, LoadingDialog, LogLevel, MediaPlaybackAllowsAirPlay, MediaPlaybackRequiresUserAction, Min/Max Version, Orientation, OSXLocalStoragePath, OverrideUserAgent, PageLength, PaginationBreakingMode, PaginationMode, PopupBlocker, SetFullscreen, ShowTitle, Suppresses3DTouchGesture, SuppressesIncrementalRendering, SuppressesLongPressGesture, TopActivityIndicator, UIWebViewDecelerationSpeed, WebSecurity, WindowSize, WindowsDefaultUriPrefix, WindowsStoreDisplayName, WindowsStoreIdentityName, WindowsStorePublisherName, WindowsToastCapable, deployment-target, target-device, windows-phone-target-version, windows-target-version]'. It must be a value from the enumeration. config.xml /Test/platforms/android/res/xml line 22 XML Problem
这是 Eclipse 生成的默认 config.xml
文件:
<?xml version='1.0' encoding='utf-8'?>
<widget id="org.adn.test" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Prueba</name>
<description>
A sample Apache Cordova application that responds to the
deviceready
event.
</description>
<author email="thym-dev@eclipse.org" href="http://www.eclipse.org/thym">
Eclipse.org -
Thym
</author>
<content src="index.html" />
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<allow-intent href="market:*" />
<preference name="loglevel" value="DEBUG" />
</widget>
这是defaults.xml
文件,也是自动生成的:
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<widget xmlns = "http://www.w3.org/ns/widgets"
id = "io.cordova.helloCordova"
version = "2.0.0">
<!-- Preferences for Android -->
<preference name="loglevel" value="DEBUG" />
</widget>
安装在我的计算机上的 Cordova 版本是 6.3.1
,但我不确定它与 Eclipse 使用的是同一个...
我一直在搜索,但找不到任何关于 Eclipse THyM 的教程或指南。甚至在他们的 Eclipse 项目的页面中也没有。很难解决这个问题。我真的不明白为什么我会在自动生成的基本示例项目中出错。
【问题讨论】:
【参考方案1】:我想我刚刚找到了自己问题的答案:
关于 Cordova 文档,Eclipse 生成为loglevel
的name
属性必须是LogLevel
。该错字导致错误出现,正如错误描述的那样。
链接到 Cordova 在 Config.xml here 上的文档。向下滚动直到找到LogLevel
。以防万一有人觉得这很有用。
我真的不知道是否有任何方式向Eclipse THyM
团队报告此问题,或者是否值得报告。
【讨论】:
那么看起来像是 Eclipse Thym 中的一个错误?可以向bugs.eclipse.org/bugs/enter_bug.cgi?product=Thym举报吗? @Mickael 完成了,这是报告的错误 URL。我的第一个:D bugs.eclipse.org/bugs/show_bug.cgi?id=500281以上是关于带有 Cordova 默认应用程序 XML 错误的 Eclipse THyM的主要内容,如果未能解决你的问题,请参考以下文章
带有扩展名的应用程序的 Ionic/Cordova iOS 应用程序构建错误 - ** 存档失败 **
带有 Phonegap Build 的 Cordova 插件白名单在 iOS 上不起作用
用于命令的 Cordova 错误代码 65:带有 args 的 xcodebuild