What's the problem? android compile error



  • Hi every one
    I'm studying to make an Android app using QT..
    After creating a sample project with a test, I tried to android build, but an error occurred.

    0_1554182473314_11처.PNG

    ============ development environment setting. ==
    QT Version : 5.12.2
    QT Creator: 4.8.2
    NDK : r19c
    Java : 1.8.0_201

    ============= Build errors are as follows =================

    Execution failed for task ':compileDebugAidl'.

    java.io.IOException: com.android.ide.common.process.ProcessException: Error while executing process C:\Users\Na\AppData\Local\Android\Sdk\build-tools\29.0.0-rc1\aidl.exe with arguments {-pC:\Users\Na\AppData\Local\Android\Sdk\platforms\android-28\framework.aidl -oE:\Dev_TestProgram\build-QtAndroidTest-Android_for_arm64_v8a_Clang_Qt_5_12_2_for_Android_ARM64_v8a-Debug\android-build\build\generated\source\aidl\debug -IE:\Dev_TestProgram\build-QtAndroidTest-Android_for_arm64_v8a_Clang_Qt_5_12_2_for_Android_ARM64_v8a-Debug\android-build\src -IE:\Dev_TestProgram\build-QtAndroidTest-Android_for_arm64_v8a_Clang_Qt_5_12_2_for_Android_ARM64_v8a-Debug\android-build\aidl -IC:\Qt\5.12.2\android_arm64_v8a\src\android\java\src -IE:\Dev_TestProgram\build-QtAndroidTest-Android_for_arm64_v8a_Clang_Qt_5_12_2_for_Android_ARM64_v8a-Debug\android-build\src\debug\aidl -dC:\Users\Na\AppData\Local\Temp\aidl263087438792580564.d C:\Qt\5.12.2\android_arm64_v8a\src\android\java\src\org\kde\necessitas\ministro\IMinistro.aidl}

    ================ It's a full log. ===================

    13:53:02: Running steps for project QtAndroidTest...
    13:53:02: Configuration unchanged, skipping qmake step.
    13:53:02: Starting: "D:\ndk\android-ndk-r19c-windows-x86_64\android-ndk-r19c\prebuilt\windows-x86_64\bin\make.exe" -j8
    make: Nothing to be done for `first'.
    13:53:03: The process "D:\ndk\android-ndk-r19c-windows-x86_64\android-ndk-r19c\prebuilt\windows-x86_64\bin\make.exe" exited normally.
    13:53:03: Removing directory E:\Dev_TestProgram\build-QtAndroidTest-Android_for_arm64_v8a_Clang_Qt_5_12_2_for_Android_ARM64_v8a-Debug\android-build/assets
    13:53:04: Removing directory E:\Dev_TestProgram\build-QtAndroidTest-Android_for_arm64_v8a_Clang_Qt_5_12_2_for_Android_ARM64_v8a-Debug\android-build/libs
    13:53:04: Starting: "D:\ndk\android-ndk-r19c-windows-x86_64\android-ndk-r19c\prebuilt\windows-x86_64\bin\make.exe" "INSTALL_ROOT=E:\Dev_TestProgram\build-QtAndroidTest-Android_for_arm64_v8a_Clang_Qt_5_12_2_for_Android_ARM64_v8a-Debug\android-build" install
    C:\Qt\5.12.2\android_arm64_v8a\bin\qmake.exe -install qinstall -exe libQtAndroidTest.so E:\Dev_TestProgram\build-QtAndroidTest-Android_for_arm64_v8a_Clang_Qt_5_12_2_for_Android_ARM64_v8a-Debug\android-build\libs\arm64-v8a\libQtAndroidTest.so
    13:53:05: The process "D:\ndk\android-ndk-r19c-windows-x86_64\android-ndk-r19c\prebuilt\windows-x86_64\bin\make.exe" exited normally.
    13:53:05: Starting: "C:\Qt\5.12.2\android_arm64_v8a\bin\androiddeployqt.exe" --input E:/Dev_TestProgram/build-QtAndroidTest-Android_for_arm64_v8a_Clang_Qt_5_12_2_for_Android_ARM64_v8a-Debug/android-libQtAndroidTest.so-deployment-settings.json --output E:/Dev_TestProgram/build-QtAndroidTest-Android_for_arm64_v8a_Clang_Qt_5_12_2_for_Android_ARM64_v8a-Debug/android-build --android-platform android-28 --jdk "C:/Program Files/Java/jdk1.8.0_201" --gradle
    Generating Android Package
    Input file: E:/Dev_TestProgram/build-QtAndroidTest-Android_for_arm64_v8a_Clang_Qt_5_12_2_for_Android_ARM64_v8a-Debug/android-libQtAndroidTest.so-deployment-settings.json
    Output directory: E:/Dev_TestProgram/build-QtAndroidTest-Android_for_arm64_v8a_Clang_Qt_5_12_2_for_Android_ARM64_v8a-Debug/android-build/
    Application binary: E:/Dev_TestProgram/build-QtAndroidTest-Android_for_arm64_v8a_Clang_Qt_5_12_2_for_Android_ARM64_v8a-Debug/libQtAndroidTest.so
    Android build platform: android-28
    Install to device: No
    -- Skipping C:/Qt/5.12.2/android_arm64_v8a/plugins/iconengines/libqsvgicon.so. It has unmet dependencies: lib/libQt5Svg.so,lib/libQt5Widgets.so.
    -- Skipping C:/Qt/5.12.2/android_arm64_v8a/plugins/imageformats/libqsvg.so. It has unmet dependencies: lib/libQt5Svg.so,lib/libQt5Widgets.so.
    :checkDebugClasspath UP-TO-DATE
    :preBuild UP-TO-DATE
    :preDebugBuild UP-TO-DATE
    :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\Na\AppData\Local\Android\Sdk\build-tools\29.0.0-rc1\aidl.exe with arguments {-pC:\Users\Na\AppData\Local\Android\Sdk\platforms\android-28\framework.aidl -oE:\Dev_TestProgram\build-QtAndroidTest-Android_for_arm64_v8a_Clang_Qt_5_12_2_for_Android_ARM64_v8a-Debug\android-build\build\generated\source\aidl\debug -IE:\Dev_TestProgram\build-QtAndroidTest-Android_for_arm64_v8a_Clang_Qt_5_12_2_for_Android_ARM64_v8a-Debug\android-build\src -IE:\Dev_TestProgram\build-QtAndroidTest-Android_for_arm64_v8a_Clang_Qt_5_12_2_for_Android_ARM64_v8a-Debug\android-build\aidl -IC:\Qt\5.12.2\android_arm64_v8a\src\android\java\src -IE:\Dev_TestProgram\build-QtAndroidTest-Android_for_arm64_v8a_Clang_Qt_5_12_2_for_Android_ARM64_v8a-Debug\android-build\src\debug\aidl -dC:\Users\Na\AppData\Local\Temp\aidl263087438792580564.d C:\Qt\5.12.2\android_arm64_v8a\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

    BUILD FAILED in 8s
    3 actionable tasks: 1 executed, 2 up-to-date
    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.
    13:53:22: The process "C:\Qt\5.12.2\android_arm64_v8a\bin\androiddeployqt.exe" exited with code 14.
    Error while building/deploying project QtAndroidTest (kit: Android for arm64-v8a (Clang Qt 5.12.2 for Android ARM64-v8a))
    When executing step "Build Android APK"
    13:53:22: Elapsed time: 00:19.



  • BUMP!

    Anyone?!?

    I've got the same frustrating problem! I can create apps using Android Studio, I can create desktop QT apps.... but everything I try to compile a QT Android app fails with a similar failure:

    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 D:\Android-SDK\build-tools\29.0.0-rc1\aidl.exe with arguments {-pD:\Android-SDK\platforms\android-22\framework.aidl -oD:\Qt\Examples\Qt-5.12.2\gui\build-analogclock-Android_for_x86_Clang_Qt_5_12_2_for_Android_x86-Debug\android-build\build\generated\source\aidl\debug -ID:\Qt\5.12.2\android_x86\src\android\java\src -ID:\Qt\Examples\Qt-5.12.2\gui\build-analogclock-Android_for_x86_Clang_Qt_5_12_2_for_Android_x86-Debug\android-build\src -ID:\Qt\Examples\Qt-5.12.2\gui\build-analogclock-Android_for_x86_Clang_Qt_5_12_2_for_Android_x86-Debug\android-build\src\debug\aidl -ID:\Qt\Examples\Qt-5.12.2\gui\build-analogclock-Android_for_x86_Clang_Qt_5_12_2_for_Android_x86-Debug\android-build\aidl -dC:\Users\pc\AppData\Local\Temp\aidl8825622650137816416.d D:\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
    
    BUILD FAILED in 6s
    3 actionable tasks: 1 executed, 2 up-to-date
    Building the android package failed!
      -- For more information, run this command with --verbose.
    22:51:26: The process "D:\Qt\5.12.2\android_x86\bin\androiddeployqt.exe" exited with code 14.
    Error while building/deploying project analogclock (kit: Android for x86 (Clang Qt 5.12.2 for Android x86))
    When executing step "Build Android APK"
    22:51:26: Elapsed time: 00:14.
    

    I messed around with various settings, ended up uninstalling and re-installing... still doesn't work!

    It would be great to get this working!



  • Ok, finally got mine to work. What a %@$# PITA... I really dislike windows, but it's where I chosen do android dev unfortunately.

    So... here's what I did... (it may have just been one of these that fixed the issue, but I'm too tired to go back and test them individually)

    1st: correct some invalid variables in QT's build settings/build environment (i.e. wrong slash was / instead of \)... AND add some. Specifically:

    ANDROID_HOME = D:\Android-SDK
    ANDROID_SDK_ROOT = D:\Android-SDK
    GRADLE_USER_HOME = C:\Users\pc\.gradle
    JAVA_HOME = D:\Program Files\Java\jdk1.8.0_201
    

    (obviously these need to be upd for your install directories .i.e usually on C: drive)

    Note: I specified these in Windows env settings, but it seems like they need to be specifically set in QT's env overrides.

    2nd: remove the 29.0.0RC1 from Android SDK build-tools via Android Studio SDK manager. Apply.
    Select 'show package details' to then be able to select the 28.0.3 version. Apply.

    3rd: go into theQT project/app's folder and edit the gradle.properties file... change the line to:

    androidBuildToolsVersion=28.0.3
    

    Finally: you should probably should close and reopen QT and the project.
    Build/deploy should now (hopefully/finally) work!



  • @Jay_M

    Thank you for solving this problem.
    Thank a ton.



  • @Jay_M You made my day!



  • Hi Jay_M,

    Thanks for the solution! Now I can take the jump to Qt5.12.3 with my Android project

    I tested your workarounds and the only thing you have to do is step 3:

    3rd: go into theQT project/app's folder and edit the gradle.properties file... change the line to:
    
    androidBuildToolsVersion=28.0.3
    

    I tested on some test applications and also on a real world application
    You saved me a lot of time! Now you can save some time for your other projects with less tweaking ;-)

    Eddy



  • @Eddy if you have build-tools 28.0.3 downloaded. I just deleted build-tools 29.0.0 and downloaded 28.0.3 (and do not change build folder - it configures for the only one 28.0.3 version which I have).



  • Hi Nikich,

    good find!

    I just tested with a new project and deleting the 29.0.0 folder upfront makes Qt Creator find the 28.0.3 folder automatically.

    Thanks for posting this back here ;-)

    Eddy



  • I have a similar problem. I followed the instructions of the tutorial for android and opened the analog clock example to build, deploy and start the app in the Android emulator.

    I use Qt Creator for macOS with the newest suggested Qt versuin. I get following build errors:

    /Users/burks/Library/Android/android-ndk-r20/toolchains/x86-4.9/prebuilt/darwin-x86_64/lib/gcc/i686-linux-android/4.9.x/../../../../i686-linux-android/bin/ld: error: cannot find -lc++
    clang++: error: linker command failed with exit code 1 (use -v to see invocation)
    make: *** [libshadereffects.so] Error 1
    

    Some ideas, how to make a Qt app for Android running?



  • Hi,

    I have exactly the same issue. Google Play Console requires adaptation for android-28 and arm64-v8a
    from August 19, so QT developers cannot use r16b anymore and I have used NDK r20 instead. Unfortunatelly I received -lc++ library linking problem. I am not sure why, because the library is available in the expected path, and objdump returns correct armv7 architecture.

    To solve the issue with linking I just used android-ndk-19c version. But note, that the 19c contains some bug with support of spaces in the QRC paths, so for example I had to remove this from the QRC:

    make[1]: *** No rule to make target '/project/fonts/customfont/pobrano z /project/fonts/customfont/koikj.txt', needed by 'qrc_qml.cpp'.  Stop
    


  • The error: cannot find -lc++ using ndk r20 can be solved like this:
    https://codereview.qt-project.org/c/qt/qtbase/+/264903/9/mkspecs/android-clang/qmake.conf#34

    For example to compile for android armv7 ndk r20, locate the file:
    C:\Qt\5.13.0\android_armv7\mkspecs\android-clang\qmake.conf
    and add the missing -nostdlib++
    for android x86 (i use this for emulator), locate the file:
    C:\Qt\5.13.0\android_x86\mkspecs\android-clang\qmake.conf

    For error: Execution failed for task ':compileDebugAidl'
    locate the file on your build directory, mine is: C:\dev_qt\experiments\build-test_qt_5_13_0_ARMv7-Release\android-build\gradle.properties and change androidBuildToolsVersion
    from: androidBuildToolsVersion=29.0.0
    to: androidBuildToolsVersion=28.0.3



  • @Albertino Thank your very much. Now I can build and run the calculator example project with the emulator. That's very motivating. However I get many warnings in the log. Maybe the example projects are not optimized for Android. I will check the tutorial a hallo world project.

    I zygote  : Not late-enabling -Xcheck:jni (already on)
    W zygote  : Unexpected CPU variant for X86 using defaults: x86
    W System  : ClassLoader referenced unknown path:
    I QtCore  : Start
    W linker  : "/data/app/org.qtproject.example.calculator-LvUUU6gyNuONt6Duq8qL_A==/lib/x86/libQt5Gui.so" has unsupported flags DT_FLAGS_1=0x80
    W linker  : "/data/app/org.qtproject.example.calculator-LvUUU6gyNuONt6Duq8qL_A==/lib/x86/libQt5Widgets.so" has unsupported flags DT_FLAGS_1=0x80
    W linker  : "/data/data/org.qtproject.example.calculator/qt-reserved-files/plugins/platforms/android/libqtforandroid.so" has unsupported flags DT_FLAGS_1=0x80
    I Qt      : qt started
    D OpenGLRenderer: HWUI GL Pipeline
    I zygote  : Background concurrent copying GC freed 14726(1133KB) AllocSpace objects, 18(380KB) LOS objects, 52% free, 1407KB/2MB, paused 741us total 254.773ms
    I zygote  : Do partial code cache collection, code=26KB, data=30KB
    I zygote  : After code cache collection, code=25KB, data=30KB
    I zygote  : Increasing code cache capacity to 128KB
    I zygote  : Background concurrent copying GC freed 14025(1072KB) AllocSpace objects, 20(512KB) LOS objects, 50% free, 1491KB/2MB, paused 53.091ms total 112.459ms
    I zygote  : Do partial code cache collection, code=50KB, data=56KB
    I zygote  : After code cache collection, code=48KB, data=55KB
    I zygote  : Increasing code cache capacity to 256KB
    D         : HostConnection::get() New Host Connection established 0x9a107280, tid 5700
    I zygote  : android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0
    I OpenGLRenderer: Initialized EGL, version 1.4
    D OpenGLRenderer: Swap behavior 1
    W OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
    D OpenGLRenderer: Swap behavior 0


  • @a.burks these are info/debug messages (not errors), QT is very verbose on android. You can ignore them



  • @Albertino Gracias!! . estuve 2 semanas para arreglar ese error.



  • This post is deleted!


  • @Jay_M My friend i searched for your answer for seven days. I m extremely thankful to you



  • @Jay_M Thank you very much, this worked for me!


Log in to reply