Qt: No application .pro file found, not building an APK

3.4k views Asked by At

I am fairly new to Qt and am trying to build a simple Android App. I am using Qt 5.7 using the evaluation package Qt Creator 4.2.0 (Enterprise). For some reason after I have created a AndroidManifest.xml through the Projects->Build Settings->Build Android APK 'Create Templates' I get the following error after compilation saying "No Application .pro found, not building an APK"

10:40:39: Running steps for project AndroidApp2...
10:40:39: Configuration unchanged, skipping qmake step.
10:40:39: Starting: "C:\QT_Commercial\Tools\mingw530_32\bin\mingw32-make.exe" 
C:/Qt/Qt5.1.0/5.1.0/android_armv7/bin/uic.exe ../AndroidApp2/mainwindow.ui -o ui_mainwindow.h
D:\Android\android-ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-g++ -c -Wno-psabi -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums -DANDROID -Wa,--noexecstack -std=gnu++0x -g -g -marm -O0 -fno-omit-frame-pointer -Wall -Wno-psabi -W -D_REENTRANT -fPIE -DQT_NO_PRINTDIALOG -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../../../../Qt/Qt5.1.0/5.1.0/android_armv7/mkspecs/android-g++ -I../AndroidApp2 -I../../../../Qt/Qt5.1.0/5.1.0/android_armv7/include -I../../../../Qt/Qt5.1.0/5.1.0/android_armv7/include/QtWidgets -I../../../../Qt/Qt5.1.0/5.1.0/android_armv7/include/QtGui -I../../../../Qt/Qt5.1.0/5.1.0/android_armv7/include/QtCore -I. -I. -ID:/Android/android-ndk/sources/cxx-stl/gnu-libstdc++/4.9/include -ID:/Android/android-ndk/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include -ID:/Android/android-ndk/platforms/android-9/arch-arm/usr/include -I. -o main.obj ../AndroidApp2/main.cpp
D:\Android\android-ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-g++ -c -Wno-psabi -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums -DANDROID -Wa,--noexecstack -std=gnu++0x -g -g -marm -O0 -fno-omit-frame-pointer -Wall -Wno-psabi -W -D_REENTRANT -fPIE -DQT_NO_PRINTDIALOG -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../../../../Qt/Qt5.1.0/5.1.0/android_armv7/mkspecs/android-g++ -I../AndroidApp2 -I../../../../Qt/Qt5.1.0/5.1.0/android_armv7/include -I../../../../Qt/Qt5.1.0/5.1.0/android_armv7/include/QtWidgets -I../../../../Qt/Qt5.1.0/5.1.0/android_armv7/include/QtGui -I../../../../Qt/Qt5.1.0/5.1.0/android_armv7/include/QtCore -I. -I. -ID:/Android/android-ndk/sources/cxx-stl/gnu-libstdc++/4.9/include -ID:/Android/android-ndk/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include -ID:/Android/android-ndk/platforms/android-9/arch-arm/usr/include -I. -o mainwindow.obj ../AndroidApp2/mainwindow.cpp
C:/Qt/Qt5.1.0//5.1.0/android_armv7/bin/moc.exe -DQT_NO_PRINTDIALOG -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../../../../Qt/Qt5.1.0/5.1.0/android_armv7/mkspecs/android-g++ -I../AndroidApp2 -I../../../../Qt/Qt5.1.0/5.1.0/android_armv7/include -I../../../../Qt/Qt5.1.0/5.1.0/android_armv7/include/QtWidgets -I../../../../Qt/Qt5.1.0/5.1.0/android_armv7/include/QtGui -I../../../../Qt/Qt5.1.0/5.1.0/android_armv7/include/QtCore -I. -I. -ID:/Android/android-ndk/sources/cxx-stl/gnu-libstdc++/4.9/include -ID:/Android/android-ndk/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include -ID:/Android/android-ndk/platforms/android-9/arch-arm/usr/include -I. -I/usr/include -I/usr/local/include ../AndroidApp2/mainwindow.h -o moc_mainwindow.cpp
D:\Android\android-ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-g++ -c -Wno-psabi -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums -DANDROID -Wa,--noexecstack -std=gnu++0x -g -g -marm -O0 -fno-omit-frame-pointer -Wall -Wno-psabi -W -D_REENTRANT -fPIE -DQT_NO_PRINTDIALOG -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../../../../Qt/Qt5.1.0/5.1.0/android_armv7/mkspecs/android-g++ -I../AndroidApp2 -I../../../../Qt/Qt5.1.0/5.1.0/android_armv7/include -I../../../../Qt/Qt5.1.0/5.1.0/android_armv7/include/QtWidgets -I../../../../Qt/Qt5.1.0/5.1.0/android_armv7/include/QtGui -I../../../../Qt/Qt5.1.0/5.1.0/android_armv7/include/QtCore -I. -I. -ID:/Android/android-ndk/sources/cxx-stl/gnu-libstdc++/4.9/include -ID:/Android/android-ndk/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include -ID:/Android/android-ndk/platforms/android-9/arch-arm/usr/include -I. -o moc_mainwindow.obj moc_mainwindow.cpp
D:\Android\android-ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-g++ --sysroot=D:\Android\android-ndk/platforms/android-9/arch-arm/ -Wl,-soname,libAndroidApp2.so -Wl,--no-undefined -Wl,-z,noexecstack -shared -o libAndroidApp2.so main.obj mainwindow.obj moc_mainwindow.obj   -LD:\Android\android-ndk/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a -LD:\Android\android-ndk/platforms/android-9/arch-arm//usr/lib -lgnustl_shared -lsupc++ -llog -lz -lm -ldl -lc -lgcc -LC:\Qt\Qt5.1.0\\5.1.0\android_armv7\lib -lQt5Widgets -lQt5Gui -lQt5Core -lGLESv2 
10:40:47: The process "C:\QT_Commercial\Tools\mingw530_32\bin\mingw32-make.exe" exited normally.
10:40:47: Removing directory C:/Software/QT/AndroidApps/build-AndroidApp2-Android_for_armeabi_v7a_GCC_4_9_Qt_5_1_0-Debug/android-build
10:40:47: Starting: "C:\QT_Commercial\Tools\mingw530_32\bin\mingw32-make.exe" "INSTALL_ROOT=C:/Software/QT/AndroidApps/build-AndroidApp2-Android_for_armeabi_v7a_GCC_4_9_Qt_5_1_0-Debug/android-build" install
cp -f "libAndroidApp2.so" "C:/Software/QT/AndroidApps/build-AndroidApp2-Android_for_armeabi_v7a_GCC_4_9_Qt_5_1_0-Debug/android-build/libs/armeabi-v7a/libAndroidApp2.so"
10:40:49: The process "C:\QT_Commercial\Tools\mingw530_32\bin\mingw32-make.exe" exited normally.
10:40:49: No application .pro file found, not building an APK.
10:40:49: Elapsed time: 00:10.

I have tried looking in the MakeFile but the directories all look OK. There is no type.

My .pro file is the following:

#-------------------------------------------------
#
# Project created by QtCreator 2016-12-20T10:23:38
#
#-------------------------------------------------

QT       += core gui

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = AndroidApp2
TEMPLATE = app

# The following define makes your compiler emit warnings if you use
# any feature of Qt which as been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS

# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0


SOURCES += main.cpp\
        mainwindow.cpp

HEADERS  += mainwindow.h

FORMS    += mainwindow.ui

CONFIG += mobility
MOBILITY = 

DISTFILES += \
    android/AndroidManifest.xml

ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android

I seem to have had no issues with this using Qt 5.1.

Any help would be great!

THanks

2

There are 2 answers

0
e.jahandar On

There is similar issue was there https://bugreports.qt.io/browse/QTCREATORBUG-13566 which fixed by disabling the unnecessary "make install" and "Build apk" steps on the Project's mode under the build settings.

0
Илья Ефимов On

According to qt source qmakeandroidbuildapkstep.cpp there is 2 cases with one message: .pro file not found and deploy settings .json file not found

    const QmakeProjectManager::QmakeProFileNode *node = pro->rootProjectNode()->findProFileFor(proFilePathForInputFile());
    m_skipBuilding = !node;
    if (m_skipBuilding)
        return true;

    QString inputFile = node->singleVariableValue(QmakeProjectManager::Variable::AndroidDeploySettingsFile);
    if (inputFile.isEmpty()) {
        m_skipBuilding = true;
        return true;
}

I had check out json file and found a message inside - it intended to be read by androiddeployqt. Next step was pretty simple:

/opt/Qt/5.9/android_armv7/bin/androiddeployqt --input android-libretroshare-qml-app.so-deployment-settings.json --release --verbose --gradle --stacktrace --debug --output ./

It doesn't solve my problem at all, but its messages was very helpful.