Qt:找不到应用程序.pro文件,没有构建APK

时间:2016-12-20 10:47:19

标签: android qt qt5.7

我是Qt的新手,我正在尝试构建一个简单的Android应用程序。 我正在使用Qt 5.7使用评估包Qt Creator 4.2.0(Enterprise)。 由于某种原因,我通过Projects-> Build Settings-> Build Android APK创建了AndroidManifest.xml'创建模板'编译后我收到以下错误" 找不到应用程序.pro,没有构建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.

我尝试过查看MakeFile,但目录看起来都很好。没有类型。

我的.pro文件如下:

#-------------------------------------------------
#
# 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

我似乎对Qt 5.1没有任何问题。

任何帮助都会很棒!

感谢

2 个答案:

答案 0 :(得分:0)

类似的问题是https://bugreports.qt.io/browse/QTCREATORBUG-13566通过禁用不必要的" make install"来解决。和#34;构建apk"在构建设置下执行项目模式。

答案 1 :(得分:0)

根据qt source qmakeandroidbuildapkstep.cpp,有2个案例有一条消息:找不到.pro文件并部署设置.json文件未找到

    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;
}

我查看了json文件并在里面发现了一条消息 - 它打算由androiddeployqt读取。下一步非常简单:

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

根本没有解决我的问题,但它的消息非常有帮助。