【发布时间】: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 项目的页面中也没有。很难解决这个问题。我真的不明白为什么我会在自动生成的基本示例项目中出错。
【问题讨论】:
标签: android xml eclipse cordova