Qt error when attempting to compile android APK



  • Hello,

    I'm trying to compile a simple project (Hello World) for run it on a smartphone on Android. But I can't reach that goal because there is a mistake inside the SDK and I can't solve this. I search on the internet if people has had this issue, they will but few months ago.

    CF : https://forum.qt.io/topic/55326/solved-qt-throwing-error-when-attempting-to-compile-android-apk/2

    The configuration of Qt Creator seems to be good, I add path for JDK, SDK, NDK and Ant but anyway, I can't compile ..

    That's the error, which aren't very helpful :

    Starting: "/Users/me/Qt/5.5/android_armv7/bin/androiddeployqt" --input /Users/me/Desktop/ProjectsQt/build-Android-Android_for_armeabi_v7a_GCC_4_9_Qt_5_5_1-Debug/android-libAndroid.so-deployment-settings.json --output /Users/me/Desktop/ProjectsQt/build-Android-Android_for_armeabi_v7a_GCC_4_9_Qt_5_5_1-Debug/android-build --deployment bundled --android-platform android-23 --jdk /Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home --ant /usr/local/Cellar/ant/1.9.6/bin/ant
    Generating Android Package
      Input file: /Users/me/Desktop/ProjectsQt/build-Android-Android_for_armeabi_v7a_GCC_4_9_Qt_5_5_1-Debug/android-libAndroid.so-deployment-settings.json
      Output directory: /Users/me/Desktop/ProjectsQt/build-Android-Android_for_armeabi_v7a_GCC_4_9_Qt_5_5_1-Debug/android-build/
      Application binary: /Users/me/Desktop/ProjectsQt/build-Android-Android_for_armeabi_v7a_GCC_4_9_Qt_5_5_1-Debug/libAndroid.so
      Android build platform: android-23
      Install to device: No
    Buildfile: /Users/me/Desktop/ProjectsQt/build-Android-Android_for_armeabi_v7a_GCC_4_9_Qt_5_5_1-Debug/android-build/build.xml
    
    -set-mode-check:
    
    -set-debug-files:
    
    -check-env:
     [checkenv] Android SDK Tools Revision 24.4.1
     [checkenv] Installed at /Users/me/Documents/Android/sdk
    
    -setup:
         [echo] Project Name: QtApp
      [gettype] Project Type: Application
    
    -set-debug-mode:
    
    -debug-obfuscation-check:
    
    -pre-build:
    
    -build-setup:
    [getbuildtools] Using latest Build Tools: 23.0.2
         [echo] Resolving Build Target for QtApp...
    [gettarget] Project Target:   Android 6.0
    [gettarget] API level:        23
         [echo] ----------
         [echo] Creating output directories if needed...
        [mkdir] Created dir: /Users/me/Desktop/ProjectsQt/build-Android-Android_for_armeabi_v7a_GCC_4_9_Qt_5_5_1-Debug/android-build/bin
        [mkdir] Created dir: /Users/me/Desktop/ProjectsQt/build-Android-Android_for_armeabi_v7a_GCC_4_9_Qt_5_5_1-Debug/android-build/bin/res
        [mkdir] Created dir: /Users/me/Desktop/ProjectsQt/build-Android-Android_for_armeabi_v7a_GCC_4_9_Qt_5_5_1-Debug/android-build/bin/rsObj
        [mkdir] Created dir: /Users/me/Desktop/ProjectsQt/build-Android-Android_for_armeabi_v7a_GCC_4_9_Qt_5_5_1-Debug/android-build/bin/rsLibs
        [mkdir] Created dir: /Users/me/Desktop/ProjectsQt/build-Android-Android_for_armeabi_v7a_GCC_4_9_Qt_5_5_1-Debug/android-build/gen
        [mkdir] Created dir: /Users/me/Desktop/ProjectsQt/build-Android-Android_for_armeabi_v7a_GCC_4_9_Qt_5_5_1-Debug/android-build/bin/classes
        [mkdir] Created dir: /Users/me/Desktop/ProjectsQt/build-Android-Android_for_armeabi_v7a_GCC_4_9_Qt_5_5_1-Debug/android-build/bin/dexedLibs
         [echo] ----------
         [echo] Resolving Dependencies for QtApp...
    [dependency] Library dependencies:
    [dependency] No Libraries
    [dependency] 
    [dependency] ------------------
         [echo] ----------
         [echo] Building Libraries with 'debug'...
       [subant] No sub-builds to iterate on
    
    -code-gen:
    [mergemanifest] Merging AndroidManifest files into one.
    [mergemanifest] Manifest merger disabled. Using project manifest only.
         [echo] Handling aidl files...
         [aidl] Found 2 AIDL files.
         [aidl] Compiling 2 AIDL files.
    
    BUILD FAILED
    /Users/me/Documents/Android/sdk/tools/ant/build.xml:649: The following error occurred while executing this line:
    /Users/me/Documents/Android/sdk/tools/ant/build.xml:655: null returned: 139
    
    Total time: 2 seconds
    Building the android package failed!
      -- For more information, run this command with --verbose.
    14:15:26: The process "/Users/me/Qt/5.5/android_armv7/bin/androiddeployqt" exited with code 14.
    Error while building/deploying project (kit : Android for armeabi-v7a (GCC 4.9, Qt 5.5.1))
    When executing step "Build Android APK"
    

    Thanks a lot !


  • Lifetime Qt Champion

    Hi,

    I don't have a direct answer for that, but as an alternative you could use gradle. There's a checkbox for that in the Android Settings from Qt Creator. Note that you will have to do a clean build once checked.

    Hope it helps



  • Hi,

    I try to do that but I have this error :

    * What went wrong:
    Execution failed for task ':compileDebugAidl'.
    > com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Users/me/Documents/Android/sdk/build-tools/23.0.2/aidl'' finished with non-zero exit value 139
    

    Do you have any idea of solutions ?


  • Lifetime Qt Champion

    Did you do a full rebuild of your project ? i.e. nuke the shadow build before compiling.



  • Yes of course, to be sure, I deleted the whole folder which came after building.

    But the error is the same as the error with ant, it's always about aidl inside of sdk/tools/ant/build.xml.



  • @Lordful have you taken a look at this post? It looks similar to your issue and there are some suggestions, mostly related to Ant.



  • @Pablo-J.-Rogina Hum yeah, I read that but it's an old topic, maybe it's because API 23 has problems ?

    EDIT : I tried to build with API-10 and API-18 but there is this error, again and again :

    [mergemanifest] Manifest merger disabled. Using project manifest only.
         [echo] Handling aidl files...
         [aidl] Found 2 AIDL files.
         [aidl] Compiling 2 AIDL files.
    
    BUILD FAILED
    /Users/me/Documents/Android/sdk/tools/ant/build.xml:658: The following error occurred while executing this line:
    /Users/me/Documents/Android/sdk/tools/ant/build.xml:664: null returned: 139
    


  • @Lordful mmm it looks definitely connected to Ant... Could you please describe your environment (OS, tools version, installation paths)?

    Also, have you taken a look at build.xml:664, the line with the error?

    In addition, this bug report may be applicable to you



  • @Pablo-J.-Rogina Here is the informations :

    OS : OS X 10.7.5
    JDK : 1.8.0_73
    path : /Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home

    SDK : 24.4.1 - Latest on official website
    path : /Users/me/Documents/Android/sdk

    NDK : r11b-darwin-x86_64 - Latest on official website
    path : /Users/me/Documents/Android/ndk

    Ant : 1.9.6
    path : /usr/local/Cellar/ant/1.9.6/bin/ant

    EDIT : Build Tools: 23.0.2

    Available version of Android : API 18, 10.

    Here is the error on line of build.xml :

    <aidl executable="${aidl}"
                        framework="${project.target.framework.aidl}"
                        libraryBinAidlFolderPathRefid="project.library.bin.aidl.folder.path"
                        genFolder="${gen.absolute.dir}"
                        aidlOutFolder="${out.aidl.absolute.dir}">
                    <source path="${source.absolute.dir}"/>
    </aidl>
    

    I test each value of this and there are all good, except project.library.bin... which isn't a value.



  • Solved by using an other sdk build-tools, I installed sdk build-tools 19.1 and I can build now.

    Next step : Launch emulator and my application on this old mac with 2 GB ram, actually, 1.80GB are used. It will be funny :D



  • Glad you solved it, please don't forget to change the post status accordingly. On the emulator side... be patient!



  • @Pablo-J.-Rogina As I said ... it was to simple to be true :D

    First, I can't launch an emulator, I guess that It's because I don't have a lot of RAM.

    Second, I tried to use a smartphone ... one more time, Android have a problem because Qt can't find my device even after installing a specific driver.

    I found a solution, it's to add manually the smartphone to adb and then, kill-server and restart the adb server. That's where is the problem because I can't do anything with adb without receive :

    Illegal Instruction : 4
    

    So, I change the version of plateform-tools but this time, the problem is still present ...

    I didn't like Android and I'm still not starting to like it right now ... :D

    SOLUTION : Download an older platform-tools and replace the folder by the download folder.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.