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

Cannot debug minimal App on Android



  • Using Qt 5.2.1, Android SDK 22, Android API 19, Android NDK 9, working on 32bit Ubuntu 14.04.
    Tried with a real Android 4.1 phone and a virtual Android 4.4 phone.

    When I create a new Android App project, Qt Creator create a minimal example with an empty *.ui file for the main window. I can run and debug this application.

    But I do not want to use *.ui files. I want to create my widgets programmatically. When I do so, the debugger waits about one minute for something and then says "'org.qtproject.example.DebugTest' konnte nicht gestartet werden." (not able to start the application). But this is wrong, the application started on the mobile device.

    This is the whole program:
    @
    #include <QApplication>
    #include <QPushButton>
    #include <QVBoxLayout>

    int main(int argc, char *argv[])
    {
    QApplication app(argc, argv);

    QWidget* window=new QWidget();
    QVBoxLayout* layout=new QVBoxLayout();
    window->setLayout(layout);
    QPushButton* button=new QPushButton("Hello");
    layout->addWidget(button);
    window->show();
    
    return app.exec();
    

    }
    @

    What am I doing wrong?



  • Your code looks ok,

    Did you use the same project template as with your ui files?

    Or did you start over in a new project?



  • Yes, I edited the auto-generated project. I just removed the mainwindow.ui, mainwindow.cpp and mainwindow.h file. So there is only the projectfile and main.cpp left. I did not edit the project file. Of course QT removed the three files automatically from it.

    Was that wrong?

    This is the project file:
    @
    TARGET = DebugTest
    TEMPLATE = app
    MOBILITY =
    QT += core gui widgets
    SOURCES += main.cpp
    HEADERS +=
    FORMS +=
    CONFIG += mobility
    ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android
    OTHER_FILES +=
    @

    The problem occurs also when I reduce the program to the following:

    @
    int main(int argc, char *argv[])
    {
    QApplication app(argc, argv);
    return app.exec();
    }
    @



  • Since today morning, the problem occurs on my mobile phone also with the unmodified template that Qt creator generates when I create a new Android Widget application. So it does not make any difference naymore, whether I use a *.ui file or not.

    Of course, I rebootet the phone several times and I started over with a new project. I cleaned all temp directories that I am aware of. No luck, I cannot debug applications on my phone anymore. The problem occurs always now.

    I borrowed another device (a Tablet with Android 4.1.2), same problem here.


Log in to reply