OpenSuse 13.2 上的 Qt for Android

Posted

技术标签:

【中文标题】OpenSuse 13.2 上的 Qt for Android【英文标题】:Qt for Android on OpenSuse 13.2 【发布时间】:2014-11-25 15:38:50 【问题描述】:

我刚刚从 Opensuse 13.1 升级到 13.2,无法再让我的 Qt 开发为 android 正常工作。我的调查让我相信,这更像是一个 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.

【问题讨论】:

我看了推荐使用Oracle JDK进行android开发。你可以试试。 fr.opensuse.org/SDB:Installer_Java#Installer_Java_d.27Oracle 谢谢,但我在使用 Oracle JDK 时仍然遇到同样的错误 【参考方案1】:

我通过使用 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” 已检查(已安装)[注意:X 代表任何版本号],并且 接受完全卸载该软件。 现在搜索“xerces-j2”。 检查(安装)“xerces-j2”、“xerces-j2-xml-apis”、 结果列表中的“xerces-j2-xml-resolver”并接受安装 他们或者如果他们目前被检查,不要碰他们! 这就是我解决这个问题的全部方法。

【讨论】:

这也解决了我的问题。真的非常感谢。

以上是关于OpenSuse 13.2 上的 Qt for Android的主要内容,如果未能解决你的问题,请参考以下文章

无法从 USB 安装 openSUSE 13.2 - linuxrc 启动

opensuse13.2上搭建caffe开发环境

无法打开与您的身份验证代理的连接 opensuse 13.2

在 openSUSE 13.2 中运行的 Android Studio Workspace 中的设备权限不足

在 opensuse 上构建 Python kerberos 扩展失败

获取在 Qt5 中工作的 opencv_gpu 函数