我刚刚从Opensuse 13.1升级到13.2,无法再让我的AndroidQt开发正常工作。我的调查让我相信这更像是一个Android开发问题(ant),而不是与Qt有关。
我在尝试部署示例项目时收到以下错误。我发现它可能与缺少 xml-apis 包有关,可能 xml-commons 包应该提供此功能,但它们似乎没有。
我对Java一点也不熟悉,并且已经坚持了一段时间了。任何建议表示赞赏。
22:46:33: Starting: "/home/bobstaff/Qt/5.3/android_armv7/bin/androiddeployqt" --input /home/bobstaff/Qt/Examples/Qt-5.3/quick/scenegraph/build-openglunderqml-Android_for_armeabi_v7a_GCC_4_9_Qt_5_3_2-Debug/android-libopenglunderqml.so-deployment-settings.json --output /home/bobstaff/Qt/Examples/Qt-5.3/quick/scenegraph/build-openglunderqml-Android_for_armeabi_v7a_GCC_4_9_Qt_5_3_2-Debug/android-build --deployment bundled --install --ant /usr/bin/ant --android-platform android-21 --jdk /usr/lib64/jvm/java-1.7.0-openjdk --device 10.1.2.5:5555
22:46:33: Pulling files necessary for debugging.
22:46:33: Package deploy: Running command '/home/bobstaff/android/adt-bundle-linux-x86_64-20140702/sdk/platform-tools/adb -s 10.1.2.5:5555 pull /system/bin/app_process /home/bobstaff/Qt/Examples/Qt-5.3/quick/scenegraph/build-openglunderqml-Android_for_armeabi_v7a_GCC_4_9_Qt_5_3_2-Debug/app_process'.
22:46:33: Package deploy: Running command '/home/bobstaff/android/adt-bundle-linux-x86_64-20140702/sdk/platform-tools/adb -s 10.1.2.5:5555 pull /system/lib/libc.so /home/bobstaff/Qt/Examples/Qt-5.3/quick/scenegraph/build-openglunderqml-Android_for_armeabi_v7a_GCC_4_9_Qt_5_3_2-Debug/libc.so'.
BUILD FAILED
/home/bobstaff/android/adt-bundle-linux-x86_64-20140702/sdk/tools/ant/build.xml:407: java.lang.NoClassDefFoundError: org/w3c/dom/ElementTraversal
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at org.apache.xerces.parsers.AbstractDOMParser.startDocument(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.startDocument(Unknown Source)
at org.apache.xerces.impl.XMLDocumentScannerImpl.startEntity(Unknown Source)
at org.apache.xerces.impl.XMLVersionDetector.startDocumentParsing(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
at com.sun.org.apache.xpath.internal.jaxp.XPathImpl.evaluate(XPathImpl.java:466)
at com.sun.org.apache.xpath.internal.jaxp.XPathImpl.evaluate(XPathImpl.java:513)
at com.android.ant.GetTypeTask.execute(GetTypeTask.java:85)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
at org.apache.tools.ant.Main.runBuild(Main.java:851)
at org.apache.tools.ant.Main.startAnt(Main.java:235)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Caused by: java.lang.ClassNotFoundException: org.w3c.dom.ElementTraversal
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 40 more
Total time: 0 seconds
Generating Android Package
Input file: /home/bobstaff/Qt/Examples/Qt-5.3/quick/scenegraph/build-openglunderqml-Android_for_armeabi_v7a_GCC_4_9_Qt_5_3_2-Debug/android-libopenglunderqml.so-deployment-settings.json
Output directory: /home/bobstaff/Qt/Examples/Qt-5.3/quick/scenegraph/build-openglunderqml-Android_for_armeabi_v7a_GCC_4_9_Qt_5_3_2-Debug/android-build
Application binary: /home/bobstaff/Qt/Examples/Qt-5.3/quick/scenegraph/build-openglunderqml-Android_for_armeabi_v7a_GCC_4_9_Qt_5_3_2-Debug/libopenglunderqml.so
Android build platform: android-21
Install to device: 10.1.2.5:5555
Buildfile: /home/bobstaff/Qt/Examples/Qt-5.3/quick/scenegraph/build-openglunderqml-Android_for_armeabi_v7a_GCC_4_9_Qt_5_3_2-Debug/android-build/build.xml
-set-mode-check:
-set-debug-files:
-check-env:
[checkenv] Android SDK Tools Revision 23.0.5
[checkenv] Installed at /home/bobstaff/android/adt-bundle-linux-x86_64-20140702/sdk
-setup:
[echo] Project Name: QtApp
Building the android package failed!
-- For more information, run this command with --verbose.
22:46:36: The process "/home/bobstaff/Qt/5.3/android_armv7/bin/androiddeployqt" exited with code 14.
Error while building/deploying project openglunderqml (kit: Android for armeabi-v7a (GCC 4.9, Qt 5.3.2))
When executing step "Deploy to Android device"
22:46:36: Elapsed time: 00:04.
我通过使用opensuse 13.2软件管理器删除"xml-commons","xml-commons-jaxp-1.3-apis"并安装"xerces-j2","xerces-j2-xml-apis","xerces-j2-xml-resolver"来解决同样的问题,我的项目报告构建成功。
完成澄清步骤:
- 从"Yast2"控制中心打开"软件管理"。
- 搜索"XML-commons"。
- 取消选中"xml-commons"、"xml-commons-jaxp-1"。X-apis' if are已检查(已安装)[注意:X 代表任何版本号],以及接受以完成卸载该软件。
- 现在搜索'xerces-j2'。 Check(install) 'xerces-j2', '
- xerces-j2-xml-apis',结果列表中的"xerces-j2-xml-resolver"和接受安装时他们或者如果他们当前被检查,不要嘟嘟他们!
这就是我对这个问题的所有解决方案。