Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Compile Android Failed



  • I have compiled my project on android but not work,but if I compile in Desktop it work.

    initializing deployment to Android device/simulator
    Deploying to emulator-5554
    17:24:12: Running steps for project untitled2...
    17:24:12: Starting: "C:\Qt\5.12.2\android_x86\bin\qmake.exe" D:\GoogleDrive\c++\QT\untitled2\untitled2.pro -spec android-clang "CONFIG+=debug" "CONFIG+=qml_debug"
    Info: creating stash file D:\GoogleDrive\c++\QT\build-untitled2-Android_for_x86_Clang_Qt_5_12_2_for_Android_x862_d0bc9c-Debug\.qmake.stash
    17:24:13: The process "C:\Qt\5.12.2\android_x86\bin\qmake.exe" exited normally.
    17:24:13: Starting: "C:\Users\orefi\AppData\Local\Android\Sdk\ndk-bundle\prebuilt\windows-x86_64\bin\make.exe" -f D:/GoogleDrive/c++/QT/build-untitled2-Android_for_x86_Clang_Qt_5_12_2_for_Android_x862_d0bc9c-Debug/Makefile qmake_all
    make: Nothing to be done for `qmake_all'.
    17:24:13: The process "C:\Users\orefi\AppData\Local\Android\Sdk\ndk-bundle\prebuilt\windows-x86_64\bin\make.exe" exited normally.
    17:24:13: Starting: "C:\Users\orefi\AppData\Local\Android\Sdk\ndk-bundle\prebuilt\windows-x86_64\bin\make.exe" -j8
    C:\Users\orefi\AppData\Local\Android\Sdk\ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++ -c -D__ANDROID_API__=16 -target i686-none-linux-android -mstackrealign -gcc-toolchain C:\Users\orefi\AppData\Local\Android\Sdk\ndk-bundle/toolchains/x86-4.9/prebuilt/windows-x86_64 -fno-limit-debug-info -DANDROID_HAS_WSTRING --sysroot=C:\Users\orefi\AppData\Local\Android\Sdk\ndk-bundle/sysroot -isystem C:\Users\orefi\AppData\Local\Android\Sdk\ndk-bundle/sysroot/usr/include/i686-linux-android -isystem C:\Users\orefi\AppData\Local\Android\Sdk\ndk-bundle/sources/cxx-stl/llvm-libc++/include -isystem C:\Users\orefi\AppData\Local\Android\Sdk\ndk-bundle/sources/android/support/include -isystem C:\Users\orefi\AppData\Local\Android\Sdk\ndk-bundle/sources/cxx-stl/llvm-libc++abi/include -fstack-protector-strong -DANDROID -g -g -std=gnu++11 -Wall -W -D_REENTRANT -fPIC -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_QUICK_LIB -DQT_GUI_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I..\untitled2 -I. -IC:\Qt\5.12.2\android_x86\include -IC:\Qt\5.12.2\android_x86\include\QtQuick -IC:\Qt\5.12.2\android_x86\include\QtGui -IC:\Qt\5.12.2\android_x86\include\QtQml -IC:\Qt\5.12.2\android_x86\include\QtNetwork -IC:\Qt\5.12.2\android_x86\include\QtCore -I. -IC:\Qt\5.12.2\android_x86\mkspecs\android-clang -o main.obj ..\untitled2\main.cpp
    C:\Qt\5.12.2\android_x86\bin\rcc.exe -name qml ..\untitled2\qml.qrc -o qrc_qml.cpp
    C:\Users\orefi\AppData\Local\Android\Sdk\ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++ -c -D__ANDROID_API__=16 -target i686-none-linux-android -mstackrealign -gcc-toolchain C:\Users\orefi\AppData\Local\Android\Sdk\ndk-bundle/toolchains/x86-4.9/prebuilt/windows-x86_64 -fno-limit-debug-info -DANDROID_HAS_WSTRING --sysroot=C:\Users\orefi\AppData\Local\Android\Sdk\ndk-bundle/sysroot -isystem C:\Users\orefi\AppData\Local\Android\Sdk\ndk-bundle/sysroot/usr/include/i686-linux-android -isystem C:\Users\orefi\AppData\Local\Android\Sdk\ndk-bundle/sources/cxx-stl/llvm-libc++/include -isystem C:\Users\orefi\AppData\Local\Android\Sdk\ndk-bundle/sources/android/support/include -isystem C:\Users\orefi\AppData\Local\Android\Sdk\ndk-bundle/sources/cxx-stl/llvm-libc++abi/include -fstack-protector-strong -DANDROID -g -g -std=gnu++11 -Wall -W -D_REENTRANT -fPIC -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_QUICK_LIB -DQT_GUI_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I..\untitled2 -I. -IC:\Qt\5.12.2\android_x86\include -IC:\Qt\5.12.2\android_x86\include\QtQuick -IC:\Qt\5.12.2\android_x86\include\QtGui -IC:\Qt\5.12.2\android_x86\include\QtQml -IC:\Qt\5.12.2\android_x86\include\QtNetwork -IC:\Qt\5.12.2\android_x86\include\QtCore -I. -IC:\Qt\5.12.2\android_x86\mkspecs\android-clang -o qrc_qml.obj qrc_qml.cpp
    C:\Users\orefi\AppData\Local\Android\Sdk\ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++ -D__ANDROID_API__=16 -target i686-none-linux-android -mstackrealign -gcc-toolchain C:\Users\orefi\AppData\Local\Android\Sdk\ndk-bundle/toolchains/x86-4.9/prebuilt/windows-x86_64 -fno-limit-debug-info -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libatomic.a --sysroot=C:\Users\orefi\AppData\Local\Android\Sdk\ndk-bundle/platforms/android-16/arch-x86/ -Wl,-soname,libuntitled2.so -Wl,-rpath=C:/Qt/5.12.2/android_x86/lib -Wl,--no-undefined -Wl,-z,noexecstack -shared -o libuntitled2.so main.obj qrc_qml.obj   -LC:/Qt/5.12.2/android_x86/lib -lQt5Quick -LC:\Qt\5.12.2\android_x86/lib -Lc:\Utils\Android\android-ndk-r18b/sources/cxx-stl/llvm-libc++/libs/x86 -lQt5Gui -lQt5Qml -lQt5Network -lQt5Core -lGLESv2  -LC:\Users\orefi\AppData\Local\Android\Sdk\ndk-bundle/sources/cxx-stl/llvm-libc++/libs/x86 C:\Users\orefi\AppData\Local\Android\Sdk\ndk-bundle/sources/cxx-stl/llvm-libc++/libs/x86/libc++.so.16 -llog -lz -lm -ldl -lc
    17:24:16: The process "C:\Users\orefi\AppData\Local\Android\Sdk\ndk-bundle\prebuilt\windows-x86_64\bin\make.exe" exited normally.
    17:24:16: Starting: "C:\Users\orefi\AppData\Local\Android\Sdk\ndk-bundle\prebuilt\windows-x86_64\bin\make.exe" "INSTALL_ROOT=D:\GoogleDrive\c++\QT\build-untitled2-Android_for_x86_Clang_Qt_5_12_2_for_Android_x862_d0bc9c-Debug\android-build" install
    C:\Qt\5.12.2\android_x86\bin\qmake.exe -install qinstall -exe libuntitled2.so D:\GoogleDrive\c++\QT\build-untitled2-Android_for_x86_Clang_Qt_5_12_2_for_Android_x862_d0bc9c-Debug\android-build\libs\x86\libuntitled2.so
    17:24:18: The process "C:\Users\orefi\AppData\Local\Android\Sdk\ndk-bundle\prebuilt\windows-x86_64\bin\make.exe" exited normally.
    17:24:18: Starting: "C:\Qt\5.12.2\android_x86\bin\androiddeployqt.exe" --input D:/GoogleDrive/c++/QT/build-untitled2-Android_for_x86_Clang_Qt_5_12_2_for_Android_x862_d0bc9c-Debug/android-libuntitled2.so-deployment-settings.json --output D:/GoogleDrive/c++/QT/build-untitled2-Android_for_x86_Clang_Qt_5_12_2_for_Android_x862_d0bc9c-Debug/android-build --android-platform android-28 --jdk "C:/Program Files/Java/jdk1.8.0_181" --gradle
    Generating Android Package
      Input file: D:/GoogleDrive/c++/QT/build-untitled2-Android_for_x86_Clang_Qt_5_12_2_for_Android_x862_d0bc9c-Debug/android-libuntitled2.so-deployment-settings.json
      Output directory: D:/GoogleDrive/c++/QT/build-untitled2-Android_for_x86_Clang_Qt_5_12_2_for_Android_x862_d0bc9c-Debug/android-build/
      Application binary: D:/GoogleDrive/c++/QT/build-untitled2-Android_for_x86_Clang_Qt_5_12_2_for_Android_x862_d0bc9c-Debug/libuntitled2.so
      Android build platform: android-28
      Install to device: No
      -- Skipping C:/Qt/5.12.2/android_x86/plugins/iconengines/libqsvgicon.so. It has unmet dependencies: lib/libQt5Svg.so,lib/libQt5Widgets.so.
      -- Skipping C:/Qt/5.12.2/android_x86/plugins/imageformats/libqsvg.so. It has unmet dependencies: lib/libQt5Svg.so,lib/libQt5Widgets.so.
    To honour the JVM settings for this build a new JVM will be forked. Please consider using the daemon: https://docs.gradle.org/4.6/userguide/gradle_daemon.html.
    Daemon will be stopped at the end of the build stopping after processing
    :checkDebugClasspath
    :preBuild UP-TO-DATE
    :preDebugBuild
    :compileDebugAidl FAILED
    
    FAILURE: Build failed with an exception.
    
    * What went wrong:
    Execution failed for task ':compileDebugAidl'.
    > java.io.IOException: com.android.ide.common.process.ProcessException: Error while executing process C:\Users\orefi\AppData\Local\Android\Sdk\build-tools\29.0.0-rc2\aidl.exe with arguments {-pC:\Users\orefi\AppData\Local\Android\Sdk\platforms\android-28\framework.aidl -oD:\GoogleDrive\c++\QT\build-untitled2-Android_for_x86_Clang_Qt_5_12_2_for_Android_x862_d0bc9c-Debug\android-build\build\generated\source\aidl\debug -IC:\Qt\5.12.2\android_x86\src\android\java\src -ID:\GoogleDrive\c++\QT\build-untitled2-Android_for_x86_Clang_Qt_5_12_2_for_Android_x862_d0bc9c-Debug\android-build\src -ID:\GoogleDrive\c++\QT\build-untitled2-Android_for_x86_Clang_Qt_5_12_2_for_Android_x862_d0bc9c-Debug\android-build\aidl -ID:\GoogleDrive\c++\QT\build-untitled2-Android_for_x86_Clang_Qt_5_12_2_for_Android_x862_d0bc9c-Debug\android-build\src\debug\aidl -dC:\Users\orefi\AppData\Local\Temp\aidl5751973902541725121.d C:\Qt\5.12.2\android_x86\src\android\java\src\org\kde\necessitas\ministro\IMinistro.aidl}
    
    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
    
    * Get more help at https://help.gradle.org
    
    
    Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
    See https://docs.gradle.org/4.6/userguide/command_line_interface.html#sec:command_line_warnings
    BUILD FAILED in 10s
    3 actionable tasks: 3 executed
    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.Fusion.impl
    Warning: QML import could not be resolved in any of the import paths: QtQuick.Controls.Imagine.impl
    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.Universal.impl
    Building the android package failed!
      -- For more information, run this command with --verbose.
    17:24:40: The process "C:\Qt\5.12.2\android_x86\bin\androiddeployqt.exe" exited with code 14.
    Error while building/deploying project untitled2 (kit: Android for x86 (Clang Qt 5.12.2 for Android x862))
    When executing step "Build Android APK"
    17:24:40: Elapsed time: 00:28.
    


  • Try this:
    Find the file "build.gradle" in your source tree and repalce section "buildscript " and "allprojects" as following:

    buildscript {
    repositories {
    google()
    jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.0'
    }
    

    }

    allprojects {
    repositories {
    google()
    jcenter()
    }
    }



  • @JoshuaChuang said in Compile Android Failed:

    buildscript {
    repositories {
    google()
    jcenter()
    }
    dependencies {
    classpath 'com.android.tools.build:gradle:2.3.0'
    }

    }
    allprojects {
    repositories {
    google()
    jcenter()
    }
    }

    this is result,not work:

    initializing deployment to Android device/simulator
    Deploying to emulator-5554
    19:42:14: Running steps for project ClientAndroidPaolo...
    19:42:14: Configuration unchanged, skipping qmake step.
    19:42:14: Starting: "C:\Users\orefi\AppData\Local\Android\Sdk\ndk-bundle\prebuilt\windows-x86_64\bin\make.exe" -j8
    make: Nothing to be done for `first'.
    19:42:15: The process "C:\Users\orefi\AppData\Local\Android\Sdk\ndk-bundle\prebuilt\windows-x86_64\bin\make.exe" exited normally.
    19:42:15: Removing directory D:\GoogleDrive\c++\QT\build-ClientAndroidPaolo-Android_for_x86_Clang_Qt_5_12_2_for_Android_x862-Debug\android-build/assets
    19:42:15: Removing directory D:\GoogleDrive\c++\QT\build-ClientAndroidPaolo-Android_for_x86_Clang_Qt_5_12_2_for_Android_x862-Debug\android-build/libs
    19:42:15: Starting: "C:\Users\orefi\AppData\Local\Android\Sdk\ndk-bundle\prebuilt\windows-x86_64\bin\make.exe" "INSTALL_ROOT=D:\GoogleDrive\c++\QT\build-ClientAndroidPaolo-Android_for_x86_Clang_Qt_5_12_2_for_Android_x862-Debug\android-build" install
    C:\Qt\5.12.2\android_x86\bin\qmake.exe -install qinstall -exe libClientAndroidPaolo.so D:\GoogleDrive\c++\QT\build-ClientAndroidPaolo-Android_for_x86_Clang_Qt_5_12_2_for_Android_x862-Debug\android-build\libs\x86\libClientAndroidPaolo.so
    19:42:17: The process "C:\Users\orefi\AppData\Local\Android\Sdk\ndk-bundle\prebuilt\windows-x86_64\bin\make.exe" exited normally.
    19:42:17: Starting: "C:\Qt\5.12.2\android_x86\bin\androiddeployqt.exe" --input D:/GoogleDrive/c++/QT/build-ClientAndroidPaolo-Android_for_x86_Clang_Qt_5_12_2_for_Android_x862-Debug/android-libClientAndroidPaolo.so-deployment-settings.json --output D:/GoogleDrive/c++/QT/build-ClientAndroidPaolo-Android_for_x86_Clang_Qt_5_12_2_for_Android_x862-Debug/android-build --android-platform android-28 --jdk "C:/Program Files/Java/jdk1.8.0_181" --gradle
    Generating Android Package
      Input file: D:/GoogleDrive/c++/QT/build-ClientAndroidPaolo-Android_for_x86_Clang_Qt_5_12_2_for_Android_x862-Debug/android-libClientAndroidPaolo.so-deployment-settings.json
      Output directory: D:/GoogleDrive/c++/QT/build-ClientAndroidPaolo-Android_for_x86_Clang_Qt_5_12_2_for_Android_x862-Debug/android-build/
      Application binary: D:/GoogleDrive/c++/QT/build-ClientAndroidPaolo-Android_for_x86_Clang_Qt_5_12_2_for_Android_x862-Debug/libClientAndroidPaolo.so
      Android build platform: android-28
      Install to device: No
    D:\GoogleDrive\c++\QT\ClientAndroidPaolo\._Magazzino.qml:1:Expected token `numeric literal'
      -- Skipping C:/Qt/5.12.2/android_x86/plugins/iconengines/libqsvgicon.so. It has unmet dependencies: lib/libQt5Svg.so,lib/libQt5Widgets.so.
      -- Skipping C:/Qt/5.12.2/android_x86/plugins/imageformats/libqsvg.so. It has unmet dependencies: lib/libQt5Svg.so,lib/libQt5Widgets.so.
    To honour the JVM settings for this build a new JVM will be forked. Please consider using the daemon: https://docs.gradle.org/4.6/userguide/gradle_daemon.html.
    Daemon will be stopped at the end of the build stopping after processing
    Project evaluation failed including an error in afterEvaluate {}. Run with --stacktrace for details of the afterEvaluate {} error.
    
    FAILURE: Build failed with an exception.
    
    * Where:
    Build file 'D:\GoogleDrive\c++\QT\build-ClientAndroidPaolo-Android_for_x86_Clang_Qt_5_12_2_for_Android_x862-Debug\android-build\build.gradle' line: 21
    
    * What went wrong:
    A problem occurred evaluating root project 'android-build'.
    > Could not find method implementation() for arguments [directory 'libs'] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
    
    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
    
    * Get more help at https://help.gradle.org
    
    BUILD FAILED in 6s
    
    Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
    See https://docs.gradle.org/4.6/userguide/command_line_interface.html#sec:command_line_warnings
    Warning: QML import could not be resolved in any of the import paths: io.qt.Backend
    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.Fusion.impl
    Warning: QML import could not be resolved in any of the import paths: QtQuick.Controls.Imagine.impl
    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.Universal.impl
    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
    Building the android package failed!
      -- For more information, run this command with --verbose.
    19:42:38: The process "C:\Qt\5.12.2\android_x86\bin\androiddeployqt.exe" exited with code 14.
    Error while building/deploying project ClientAndroidPaolo (kit: Android for x86 (Clang Qt 5.12.2 for Android x862))
    When executing step "Build Android APK"
    19:42:38: Elapsed time: 00:24.
    


  • I also tried some examples of QT but not work, this is my configuration:
    0_1554965068194_Cattura.JPG


Log in to reply