1

Introduction

I'm trying to compile empty qt widget to android apk, just to test if my environment and configuration is correct. However it seems that for some reason compiler doesn't see some headers files.

Test Code (mainwindow.cpp)

#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
}

MainWindow::~MainWindow()
{
    delete ui;
}

It basically doesn't do anything, it's just compilation test.

My configuration

QT 5.8

OpenJDK 8.0.5120.1

Android SDK platform 27

Android NDK r16, 32bit and 64bit (tested both)

Windows 8.1 64 bit

QT Toolkits:

  • Android for armeabi-v7a (GCC 4.9, Qt 5.8.0)
  • Android for x86 (GCC 4.9,Qt 5.8.0)

The Question

Compilation of ever android apps, including this empty one mentioned above ends with:

stdlib.h: No such file or directory

Compiling desktop (*exe) apps works fine. I just can't configure correctly my environment for compilation android apk's. I tried with different versions of Android NDK, architecture, and with "QMAKE_CFLAGS_ISYSTEM=". Nothing works so far. What should I do to make it works?

UPDATE:

Thanks to @AlexCohn help I'm a bit closer to solve the issue. After changing NDK from r16 to r10e-x86 and SDK tools to 25.2.5, compilation goes a bit more, but not reach the end, as it brakes with the following command:

Building the android package failed! -- For more information, run this command with --verbose.

Proces "C:\Programming\Qt\5.8\android_armv7\bin\androiddeployqt.exe" exited with code 14.

Error while building/deploying project and_test (kit: Android for armeabi-v7a (GCC 4.9, Qt 5.8.0)) When executing step "Build Android APK"

UPDATE 2:

Issue seems to be solved. One more change is needed as QT 5.9 seems to have compatibility issues with some versions of OpenJDK or Java SE. After a research I found that it is nesesery to install Java SE Development Kit 8. With this version, and all previous changes, finally the compilation ends successfully.

Karls
  • 731
  • 7
  • 17
  • Can you post your C++ build script? – Alex Cohn Dec 05 '17 at 06:44
  • @AlexCohn - It's default Qt build settings. I don't even know how to edit build script, I never needed to do this. As I mentioned above compiling to *exe always worked fine and I was focused on this so far. Now I want to try Android development, but encountered this bug while compiling to *apk. – Karls Dec 05 '17 at 12:21
  • QT officially [recommends](https://wiki.qt.io/Android) to use NDK r10. Windows adds some pepper to the setup. – Alex Cohn Dec 05 '17 at 13:02
  • @AlexCohn - it partially solved the issue. With NDK r10e it pass a bit more, but finnally the compiler fail with command: "Error while building/deploying project and_test (kit: Android for armeabi-v7a (GCC 4.9, Qt 5.8.0)) When executing step "Build Android APK"". I added full error to OP. – Karls Dec 05 '17 at 13:50
  • See https://stackoverflow.com/a/28292048/192373. [Don't use gradle](https://stackoverflow.com/questions/40626666/qt-creator-use-gradle-instead-of-ant-give-error). [Use an older version of SDK](https://forum.qt.io/post/379513). – Alex Cohn Dec 05 '17 at 14:38
  • 1
    @AlexCohn - ok now it works, with few more changes. If you want, you can add this as answer so I could mark this question answered. – Karls Dec 05 '17 at 21:22

0 Answers0