3

I am trying to run my first Qt Android application and I followed this tutorial:

http://urfoex.blogspot.ro/2013/12/qt5-android-setting-up-qt-52-for-android.html

However, after I ran it i got this error:

i686-linux-android-g++: error: unrecognized command line option '-marm' make: *** 
[main.o] Error 1 21:33:42: The process "make" exited with code 2.
Error while building/deploying project avd_tests (kit: Android for x86 (GCC 4.8, Qt 5.2.1)) When executing step 'Make'

I also tried using armeabi but i got:

In file included from ../.android-ndk/sources/cxx-stl/gnu-libstdc++/4.8/include/algorithm:60:0,
                 from ../.Qt5.2.1/5.2.1/android_armv7/include/QtCore/qglobal.h:82,
                 from ../.Qt5.2.1/5.2.1/android_armv7/include/QtCore/qcoreapplication.h:45,
                 from ../.Qt5.2.1/5.2.1/android_armv7/include/QtWidgets/qapplication.h:45,
                 from ../.Qt5.2.1/5.2.1/android_armv7/include/QtWidgets/QApplication:1,
                 from ../avd_tests/qtquick2controlsapplicationviewer/qtquick2controlsapplicationviewer.h:13,
                 from ../avd_tests/main.cpp:1: ../.android-ndk/sources/cxx-stl/gnu-libstdc++/4.8/include/utility:68:28: fatal error: bits/c++config.h: No such file or directory  #include <bits/c++config.h>
                            ^ compilation terminated. make: *** [main.o] Error 1 21:44:14: The process "make" exited with code 2. Error while building/deploying project avd_tests (kit: Android for armeabi-v7a (GCC 4.8, Qt 5.2.1)) When executing step 'Make'

The application I am building is a default Qt Quick application. I am using Qt 5.2.1 and QtCreator 3.0.1.

Anyone any Idea what it could be or does anyone know a good guide on how to make Qt on Android work on GNU/Linux?

Jacob Krieg
  • 2,834
  • 15
  • 68
  • 140

2 Answers2

2

You should download and install Qt 5.2.1 for Android (Linux 32-bit or 64-bit) from here. Qt Project’s SDK is not coming with Android SDK/NDK so you must download and install them yourself from here. You’ll need Android NDK (ver. r9+) and SDK (ver. 22+).

If you don’t plan to create Android Java apps, then make sure you are downloading ONLY the SDK and not ADT Bundle or Android Studio.

After downloading extract them. For Android SDK you should have a connection to Internet and download the desired tools. you have to install at least Android API-13! You also must install Android SDK Platform-tools and Android SDK Build-tools.

Open Qt Creator. Goto Tools->Option->Android settings page and set Android SDK and NDK locations.

You can find a detailed tutorial Here.

Nejat
  • 31,784
  • 12
  • 106
  • 138
  • thank you very much for the answer. I will try your example in a few hours since i'm at work now. I used the Qt 5.2.1 linux 64 online installer and installed android from there. I downloaded manually the ndk and sdk and set the paths manually from tools->option->android but you can see the result above. i will try your way though and i will let you know about the results. – Jacob Krieg Apr 09 '14 at 08:24
  • I tried it but I got the following error: And after building I get: 12:40:26: Running steps for project untitled2... 12:40:26: Configuration unchanged, skipping qmake step. 12:40:26: Starting: "make" make: Nothing to be done for `first'. 12:40:26: The process "make" exited normally. 12:40:26: Removing directory /home/user/build-untitled2-Android_for_armeabi_v7a_GCC_4_8_Qt_5_2_1-Debug/android-build 12:40:26: Starting: "make" INSTALL_ROOT=/home/user/build-untitled2-Android_for_armeabi_v7a_GCC_4_8_Qt_5_2_1-Debug/android-build install – Jacob Krieg Apr 12 '14 at 09:58
  • cp -f -R /home/user/untitled2/qml/untitled2 /home/user/build-untitled2-Android_for_armeabi_v7a_GCC_4_8_Qt_5_2_1-Debug/android-build/assets/qml/ install -m 755 -p "libuntitled2.so" "/home/user/build-untitled2-Android_for_armeabi_v7a_GCC_4_8_Qt_5_2_1-Debug/android-build/libs/armeabi-v7a/libuntitled2.so" 12:40:26: The process "make" exited normally. Error while building/deploying project untitled2 (kit: Android for armeabi-v7a (GCC 4.8, Qt 5.2.1)) When executing step 'Deploy to Android device' 12:42:40: Elapsed time: 02:14. – Jacob Krieg Apr 12 '14 at 09:59
2

It turns out it was a known bug in the newer version of Android SDK.

As pointed by Bogdan Vatra, the creator of Qt for Android, the solutions were:

  • Find an older Android SDK.
  • Upgrade your Qt creator (use Qt SDK 5.3)
  • Use a real device.

In order to solve the problem I downloaded qt-opensource-linux-x64-android-5.3.0-RC_2014-04-14_00-48-35-55.run from http://download.qt-project.org/snapshots/qt/5.3/5.3.0-RC/2014-04-14_55/ and the deploy worked successfully!

Thanks Bogdan!

Jacob Krieg
  • 2,834
  • 15
  • 68
  • 140