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

[SOLVED]Qt Throwing error when attempting to compile android APK



  • I have been trying to compile the hello world application for mobile and it just won't compile, I tried switching the build targets and all. I am good on desktop programming but just started on mobile. I have linked the SDK,NDK,Ant and JDK correctly and installed the android API. I restarted several times(both my pc and Qt) but nothing seems to fix this issue.

    21:02:18: Running steps for project CopyMe...
    21:02:18: Configuration unchanged, skipping qmake step.
    21:02:18: Starting: "C:\Qt\Tools\mingw482_32\bin\mingw32-make.exe" 
    mingw32-make: Nothing to be done for 'first'.
    21:02:19: The process "C:\Qt\Tools\mingw482_32\bin\mingw32-make.exe" exited normally.
    21:02:19: Removing directory C:\Users\Roberto\Desktop\build-CopyMe-Android_for_armeabi_GCC_4_9_Qt_5_3_2-Debug\android-build
    21:02:19: Starting: "C:\Qt\Tools\mingw482_32\bin\mingw32-make.exe" INSTALL_ROOT="C:\Users\Roberto\Desktop\build-CopyMe-Android_for_armeabi_GCC_4_9_Qt_5_3_2-Debug\android-build" install
    copy /y "libCopyMe.so" "C:\Users\Roberto\Desktop\build-CopyMe-Android_for_armeabi_GCC_4_9_Qt_5_3_2-Debug\android-build\libs\armeabi\libCopyMe.so"
            1 file(s) copied.
    21:02:20: The process "C:\Qt\Tools\mingw482_32\bin\mingw32-make.exe" exited normally.
    21:02:20: Starting: "C:\Qt\5.3\android_armv5\bin\androiddeployqt.exe" --input C:/Users/Roberto/Desktop/build-CopyMe-Android_for_armeabi_GCC_4_9_Qt_5_3_2-Debug/android-libCopyMe.so-deployment-settings.json --output C:/Users/Roberto/Desktop/build-CopyMe-Android_for_armeabi_GCC_4_9_Qt_5_3_2-Debug/android-build --deployment bundled --android-platform android-22 --jdk "C:/Program Files (x86)/Java/jdk1.8.0_45" --ant C:/Users/Roberto/Desktop/apache-ant-1.9.5/bin/ant.bat
    
    BUILD FAILED
    C:\Users\Roberto\AppData\Local\Android\sdk\tools\ant\build.xml:649: The following error occurred while executing this line:
    C:\Users\Roberto\AppData\Local\Android\sdk\tools\ant\build.xml:655: Execute failed: java.io.IOException: Cannot run program "C:\Users\Roberto\Desktop\build-CopyMe-Android_for_armeabi_GCC_4_9_Qt_5_3_2-Debug\android-build\${aidl}": CreateProcess error=2, The system cannot find the file specified
    	at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
    	at java.lang.Runtime.exec(Runtime.java:620)
    	at org.apache.tools.ant.taskdefs.launcher.Java13CommandLauncher.exec(Java13CommandLauncher.java:58)
    	at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:428)
    	at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:442)
    	at org.apache.tools.ant.taskdefs.ExecTask.runExecute(ExecTask.java:629)
    	at org.apache.tools.ant.taskdefs.ExecTask.runExec(ExecTask.java:670)
    	at org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:496)
    	at com.android.ant.AidlExecTask$AidlProcessor.process(AidlExecTask.java:102)
    	at com.android.ant.MultiFilesTask.processFiles(MultiFilesTask.java:131)
    	at com.android.ant.AidlExecTask.execute(AidlExecTask.java:203)
    	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
    	at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	at java.lang.reflect.Method.invoke(Method.java:497)
    	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.taskdefs.Sequential.execute(Sequential.java:68)
    	at com.android.ant.IfElseTask.execute(IfElseTask.java:120)
    	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
    	at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	at java.lang.reflect.Method.invoke(Method.java:497)
    	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.taskdefs.Sequential.execute(Sequential.java:68)
    	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
    	at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	at java.lang.reflect.Method.invoke(Method.java:497)
    	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.taskdefs.MacroInstance.execute(MacroInstance.java:396)
    	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
    	at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	at java.lang.reflect.Method.invoke(Method.java:497)
    	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:1405)
    	at org.apache.tools.ant.Project.executeTarget(Project.java:1376)
    	at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
    	at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
    	at org.apache.tools.ant.Main.runBuild(Main.java:853)
    	at org.apache.tools.ant.Main.startAnt(Main.java:235)
    	at org.apache.tools.ant.launch.Launcher.run(Launcher.java:285)
    	at org.apache.tools.ant.launch.Launcher.main(Launcher.java:112)
    Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
    	at java.lang.ProcessImpl.create(Native Method)
    	at java.lang.ProcessImpl.<init>(ProcessImpl.java:386)
    	at java.lang.ProcessImpl.start(ProcessImpl.java:137)
    	at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
    	... 48 more
    
    Total time: 0 seconds
    Generating Android Package
      Input file: C:/Users/Roberto/Desktop/build-CopyMe-Android_for_armeabi_GCC_4_9_Qt_5_3_2-Debug/android-libCopyMe.so-deployment-settings.json
      Output directory: C:/Users/Roberto/Desktop/build-CopyMe-Android_for_armeabi_GCC_4_9_Qt_5_3_2-Debug/android-build
      Application binary: C:/Users/Roberto/Desktop/build-CopyMe-Android_for_armeabi_GCC_4_9_Qt_5_3_2-Debug/libCopyMe.so
      Android build platform: android-22
      Install to device: No
    Buildfile: C:\Users\Roberto\Desktop\build-CopyMe-Android_for_armeabi_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 24.3.2
     [checkenv] Installed at C:\Users\Roberto\AppData\Local\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: 22.0.1
         [echo] Resolving Build Target for QtApp...
    Building the android package failed!
      -- For more information, run this command with --verbose.
    [gettarget] Project Target:   Android 5.1.1
    [gettarget] API level:        22
         [echo] ----------
         [echo] Creating output directories if needed...
        [mkdir] Created dir: C:\Users\Roberto\Desktop\build-CopyMe-Android_for_armeabi_GCC_4_9_Qt_5_3_2-Debug\android-build\bin
        [mkdir] Created dir: C:\Users\Roberto\Desktop\build-CopyMe-Android_for_armeabi_GCC_4_9_Qt_5_3_2-Debug\android-build\bin\res
        [mkdir] Created dir: C:\Users\Roberto\Desktop\build-CopyMe-Android_for_armeabi_GCC_4_9_Qt_5_3_2-Debug\android-build\bin\rsObj
        [mkdir] Created dir: C:\Users\Roberto\Desktop\build-CopyMe-Android_for_armeabi_GCC_4_9_Qt_5_3_2-Debug\android-build\bin\rsLibs
        [mkdir] Created dir: C:\Users\Roberto\Desktop\build-CopyMe-Android_for_armeabi_GCC_4_9_Qt_5_3_2-Debug\android-build\gen
        [mkdir] Created dir: C:\Users\Roberto\Desktop\build-CopyMe-Android_for_armeabi_GCC_4_9_Qt_5_3_2-Debug\android-build\bin\classes
        [mkdir] Created dir: C:\Users\Roberto\Desktop\build-CopyMe-Android_for_armeabi_GCC_4_9_Qt_5_3_2-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.
    21:02:24: The process "C:\Qt\5.3\android_armv5\bin\androiddeployqt.exe" exited with code 14.
    Error while building/deploying project CopyMe (kit: Android for armeabi (GCC 4.9, Qt 5.3.2))
    When executing step "Build Android APK"
    21:02:24: Elapsed time: 00:06.
    


  • Did you updat e your Android sdk tools? That is all I can think of that I changed, and I am now getting that issue



  • I think I have the same error, but in my case, I use Kubuntu 14.04 64 bits, Qt 5.4.2 and Qt Creator 3.4.1. I use the API for Android 4.0.3, but I tried others newer and the bug remains. I have installed Android SDK Tools 24.3.2, Android SDK Platforms-tools 22 and Android SDK Build-tools 22.0.1, 21.1.2, 20 and 19.1.

    I tried several versions of Java like OpenJDK 6, OpenJDK 7 (both from Ubuntu's repo) and Oracle JDK 8 (from the websites). I tried Ant from the repo and the current version from Apache's website and I always get the same error.

    I was thinking in reinstalling Kubuntu because everything is good. Compilers are OK, Qt versions are OK, I have the the g++-arm-linux-gnueabihf package installed, so I don't know what I'm doing bad, and IDE doesn't give me meaningful information to find a solution.

    Here is the code that Qt Creator shows me when I try to compile for Android:

    17:14:49: Running steps for project 031-CohetesAndroid-C029...
    17:14:49: Configuration unchanged, skipping qmake step.
    17:14:49: Starting: "/usr/bin/make" 
    make: Nothing to be done for `first'.
    17:14:49: The process "/usr/bin/make" exited normally.
    17:14:49: Removing directory /home/cold_distance/Qt/build-031-CohetesAndroid-C029-Android_for_armeabi_v7a_GCC_4_9_Qt_5_4_2-Debug/android-build
    17:14:49: Starting: "/usr/bin/make" INSTALL_ROOT=/home/cold_distance/Qt/build-031-CohetesAndroid-C029-Android_for_armeabi_v7a_GCC_4_9_Qt_5_4_2-Debug/android-build install
    install -m 755 -p "lib031-CohetesAndroid-C029.so" "/home/cold_distance/Qt/build-031-CohetesAndroid-C029-Android_for_armeabi_v7a_GCC_4_9_Qt_5_4_2-Debug/android-build/libs/armeabi-v7a/lib031-CohetesAndroid-C029.so"
    17:14:49: The process "/usr/bin/make" exited normally.
    17:14:49: Starting: "/opt/Qt5/5.4/android_armv7/bin/androiddeployqt" --input /home/cold_distance/Qt/build-031-CohetesAndroid-C029-Android_for_armeabi_v7a_GCC_4_9_Qt_5_4_2-Debug/android-lib031-CohetesAndroid-C029.so-deployment-settings.json --output /home/cold_distance/Qt/build-031-CohetesAndroid-C029-Android_for_armeabi_v7a_GCC_4_9_Qt_5_4_2-Debug/android-build --deployment bundled --android-platform android-15 --jdk /usr/lib/jvm/java-6-openjdk-amd64 --ant /usr/bin/ant
    Generating Android Package
      Input file: /home/cold_distance/Qt/build-031-CohetesAndroid-C029-Android_for_armeabi_v7a_GCC_4_9_Qt_5_4_2-Debug/android-lib031-CohetesAndroid-C029.so-deployment-settings.json
      Output directory: /home/cold_distance/Qt/build-031-CohetesAndroid-C029-Android_for_armeabi_v7a_GCC_4_9_Qt_5_4_2-Debug/android-build/
      Application binary: /home/cold_distance/Qt/build-031-CohetesAndroid-C029-Android_for_armeabi_v7a_GCC_4_9_Qt_5_4_2-Debug/lib031-CohetesAndroid-C029.so
      Android build platform: android-15
      Install to device: No
    Buildfile: /home/cold_distance/Qt/build-031-CohetesAndroid-C029-Android_for_armeabi_v7a_GCC_4_9_Qt_5_4_2-Debug/android-build/build.xml
    
    -set-mode-check:
    
    -set-debug-files:
    
    -check-env:
     [checkenv] Android SDK Tools Revision 24.3.2
     [checkenv] Installed at /home/cold_distance/bin/android-sdk-linux
    
    -setup:
         [echo] Project Name: QtApp
      [gettype] Project Type: Application
    
    -set-debug-mode:
    
    -debug-obfuscation-check:
    
    -pre-build:
    
    -build-setup:
    [getbuildtools] Using latest Build Tools: 22.0.1
         [echo] Resolving Build Target for QtApp...
    [gettarget] Project Target:   Android 4.0.3
    [gettarget] API level:        15
         [echo] ----------
         [echo] Creating output directories if needed...
        [mkdir] Created dir: /home/cold_distance/Qt/build-031-CohetesAndroid-C029-Android_for_armeabi_v7a_GCC_4_9_Qt_5_4_2-Debug/android-build/bin
        [mkdir] Created dir: /home/cold_distance/Qt/build-031-CohetesAndroid-C029-Android_for_armeabi_v7a_GCC_4_9_Qt_5_4_2-Debug/android-build/bin/res
        [mkdir] Created dir: /home/cold_distance/Qt/build-031-CohetesAndroid-C029-Android_for_armeabi_v7a_GCC_4_9_Qt_5_4_2-Debug/android-build/bin/rsObj
        [mkdir] Created dir: /home/cold_distance/Qt/build-031-CohetesAndroid-C029-Android_for_armeabi_v7a_GCC_4_9_Qt_5_4_2-Debug/android-build/bin/rsLibs
        [mkdir] Created dir: /home/cold_distance/Qt/build-031-CohetesAndroid-C029-Android_for_armeabi_v7a_GCC_4_9_Qt_5_4_2-Debug/android-build/gen
        [mkdir] Created dir: /home/cold_distance/Qt/build-031-CohetesAndroid-C029-Android_for_armeabi_v7a_GCC_4_9_Qt_5_4_2-Debug/android-build/bin/classes
        [mkdir] Created dir: /home/cold_distance/Qt/build-031-CohetesAndroid-C029-Android_for_armeabi_v7a_GCC_4_9_Qt_5_4_2-Debug/android-build/bin/dexedLibs
         [echo] ----------
         [echo] Resolving Dependencies for QtApp...
    [dependency] Library dependencies:
    [dependency] No Libraries
    [dependency] 
    [dependency] ------------------
    [dependency] API<=15: Adding annotations.jar to the classpath.
         [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
    /home/cold_distance/bin/android-sdk-linux/tools/ant/build.xml:649: The following error occurred while executing this line:
    /home/cold_distance/bin/android-sdk-linux/tools/ant/build.xml:655: Execute failed: java.io.IOException: Cannot run program "/home/cold_distance/Qt/build-031-CohetesAndroid-C029-Android_for_armeabi_v7a_GCC_4_9_Qt_5_4_2-Debug/android-build/${aidl}": java.io.IOException: error=2, No such file or directory
    	at java.lang.ProcessBuilder.start(ProcessBuilder.java:494)
    	at java.lang.Runtime.exec(Runtime.java:612)
    	at org.apache.tools.ant.taskdefs.launcher.Java13CommandLauncher.exec(Java13CommandLauncher.java:41)
    	at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:428)
    	at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:442)
    	at org.apache.tools.ant.taskdefs.ExecTask.runExecute(ExecTask.java:628)
    	at org.apache.tools.ant.taskdefs.ExecTask.runExec(ExecTask.java:669)
    	at org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:495)
    	at com.android.ant.AidlExecTask$AidlProcessor.process(AidlExecTask.java:102)
    	at com.android.ant.MultiFilesTask.processFiles(MultiFilesTask.java:131)
    	at com.android.ant.AidlExecTask.execute(AidlExecTask.java:203)
    	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:622)
    	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.taskdefs.Sequential.execute(Sequential.java:68)
    	at com.android.ant.IfElseTask.execute(IfElseTask.java:120)
    	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:622)
    	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.taskdefs.Sequential.execute(Sequential.java:68)
    	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:622)
    	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.taskdefs.MacroInstance.execute(MacroInstance.java:396)
    	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:622)
    	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.io.IOException: java.io.IOException: error=2, No such file or directory
    	at java.lang.UNIXProcess.<init>(UNIXProcess.java:164)
    	at java.lang.ProcessImpl.start(ProcessImpl.java:81)
    	at java.lang.ProcessBuilder.start(ProcessBuilder.java:476)
    	... 48 more
    
    Total time: 1 second
    Building the android package failed!
      -- For more information, run this command with --verbose.
    17:14:52: The process "/opt/Qt5/5.4/android_armv7/bin/androiddeployqt" exited with code 14.
    Error while building/deploying project 031-CohetesAndroid-C029 (kit: Android for armeabi-v7a (GCC 4.9, Qt 5.4.2))
    When executing step "Build Android APK"
    17:14:52: Elapsed time: 00:03.
    


  • I just reloaded my laptop and started getting this error with the latest QtCreator community edition and latest Android Studio / Android SDK setup.

    Unfortunately I never found the cause of the error using ant. I did try adding the "<ANDROID-SDK>/build-tools/<version>/" directory to my path as that is where the aidl executable is but that did not alleviate the issue.

    I was able to get my APK built by telling QtCreator to use gradle instead of ant.

    In QtCreator -> Projects -> Build & Run -> { android kit (build) } -> Build Android APK -> Advanced Actions -> Use Gradle checkbox.

    I started getting a different error I believe was related to Android build tools version. Android studio automatically installed Android Build Tools 23.0.0.R2 preview. I uninstalled the preview and left Android Build Tools V 22.0.1.

    I cleaned my Qt Project, ran qmake, and rebuilt project.

    Hope this helps. I'd love to know if anyone figures out the problem without switching to gradle.

    -Tom



  • Seems to be fixed in latest Android SDK Tools Version 24.3.3



  • @sk2212 Yes, now I can compile for Android again :) .



  • Thanks a lot for the advice and idea's to fix this problem, I will let you guys know if I can fix it myself when I have access to my computer. I felt frustrated and gave up but it's good to know I might be able to finally compile.



  • Use the latest version of the SDK(At this time 24.3.3), Use Ant(Gradle still won't work), Use the latest NDK and latest Qt Creator Release.(5.4 at this time). That's what I did to get it to work for me. Large thanks to sk2212 and all the other idea's!