Qt创建者没有为android构建项目

时间:2017-06-13 14:02:48

标签: android qt build qt-creator

我在Linux Ubuntu上配置了SDK,JDK,NDK。但是当我尝试为android构建我的项目时,会发生这些错误(所有编译输出):

18:28:22: Running steps for project InstaDL...
18:28:22: Configuration unchanged, skipping qmake step.
18:28:22: Starting: "/usr/bin/make" 
make: Nothing to be done for 'first'.
18:28:22: The process "/usr/bin/make" exited normally.
18:28:22: Removing directory /home/muhammad/Documents/qt_projects/build-InstaDL-Android_for_armeabi_v7a_GCC_4_9_Qt_5_9_0_for_Android_armv7-Release/android-build/assets
18:28:22: Removing directory /home/muhammad/Documents/qt_projects/build-InstaDL-Android_for_armeabi_v7a_GCC_4_9_Qt_5_9_0_for_Android_armv7-Release/android-build/libs
18:28:22: Starting: "/usr/bin/make" INSTALL_ROOT=/home/muhammad/Documents/qt_projects/build-InstaDL-Android_for_armeabi_v7a_GCC_4_9_Qt_5_9_0_for_Android_armv7-Release/android-build install
/home/muhammad/Qt5.9.0/5.9/android_armv7/bin/qmake -install qinstall program libInstaDL.so /home/muhammad/Documents/qt_projects/build-InstaDL-Android_for_armeabi_v7a_GCC_4_9_Qt_5_9_0_for_Android_armv7-Release/android-build/libs/armeabi-v7a/libInstaDL.so
18:28:22: The process "/usr/bin/make" exited normally.
18:28:22: Starting: "/home/muhammad/Qt5.9.0/5.9/android_armv7/bin/androiddeployqt" --input /home/muhammad/Documents/qt_projects/build-InstaDL-Android_for_armeabi_v7a_GCC_4_9_Qt_5_9_0_for_Android_armv7-Release/android-libInstaDL.so-deployment-settings.json --output /home/muhammad/Documents/qt_projects/build-InstaDL-Android_for_armeabi_v7a_GCC_4_9_Qt_5_9_0_for_Android_armv7-Release/android-build --deployment bundled --android-platform android-25 --jdk /home/muhammad/Android/jdk1.8.0_131 --gradle
Generating Android Package
  Input file: /home/muhammad/Documents/qt_projects/build-InstaDL-Android_for_armeabi_v7a_GCC_4_9_Qt_5_9_0_for_Android_armv7-Release/android-libInstaDL.so-deployment-settings.json
  Output directory: /home/muhammad/Documents/qt_projects/build-InstaDL-Android_for_armeabi_v7a_GCC_4_9_Qt_5_9_0_for_Android_armv7-Release/android-build/
  Application binary: /home/muhammad/Documents/qt_projects/build-InstaDL-Android_for_armeabi_v7a_GCC_4_9_Qt_5_9_0_for_Android_armv7-Release/libInstaDL.so
  Android build platform: android-25
  Install to device: No
Warning: QML import could not be resolved in any of the import paths: Qt.Class
Warning: QML import could not be resolved in any of the import paths: QtQuick.Extras.Private.CppUtils
Warning: QML import could not be resolved in any of the import paths: QtQuick.Extras.Private.CppUtils
Warning: QML import could not be resolved in any of the import paths: QtQuick.Controls.Material.impl
Warning: QML import could not be resolved in any of the import paths: QtQuick.Controls.impl
Warning: QML import could not be resolved in any of the import paths: QtQuick.Controls.Universal.impl
Exception in thread "main" java.lang.RuntimeException: Timeout of 120000 reached waiting for exclusive access to file: /home/muhammad/.gradle/wrapper/dists/gradle-3.4-bin/aeufj4znodijbvwfbsq3044r0/gradle-3.4-bin.zip
    at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:65)
    at org.gradle.wrapper.Install.createDist(Install.java:48)
    at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:107)
    at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
Building the android package failed!
  -- For more information, run this command with --verbose.
18:30:23: The process "/home/muhammad/Qt5.9.0/5.9/android_armv7/bin/androiddeployqt" exited with code 14.
Error while building/deploying project InstaDL (kit: Android for armeabi-v7a (GCC 4.9, Qt 5.9.0 for Android armv7))
When executing step "Build Android APK"
18:30:23: Elapsed time: 02:01.

我应该怎么做才能修复它?提前谢谢。

1 个答案:

答案 0 :(得分:0)

例外中的关键行是:

Exception in thread "main" java.lang.RuntimeException: Timeout of 120000 reached waiting for exclusive access to file: /home/muhammad/.gradle/wrapper/dists/gradle-3.4-bin/aeufj4znodijbvwfbsq3044r0/gradle-3.4-bin.zip`

在我以前的雇主,很久以前我们遇到了同样的问题(使用 gradle 1.x )。它或者是 gradle 本身的限制或者它的使用方式( gradle 不是 构建工具,它只是一个帮手在完整构建期间执行了十分之一次。)[Gradle]: Gradle-1.1: “Timeout after waiting 120.0 seconds for Gradle Worker N to connect.”包含类似的行为。

但是,根据:[Gradle]: Running multiple gradle processes concurrently

  

您可以合理安全地在同一个项目上运行两个Gradle流程,只要他们不会弄乱彼此正在做的事情(例如删除创建的文件)。

摆脱这种情况的一种方式(对我有用):

  • 找到保持文件锁定的( gradle java )进程(可能是以前的构建挂起) - 您可以使用[man]: lsof查找锁定文件的过程 - 并将其杀死
  • 如果上述步骤不够,还要清理 gradle 的缓存