我正在尝试在Windows下使用Qt5和Qt3D在Android上部署测试程序。构建 qt3d 是成功的,仍然需要手动将库和源代码复制到我的 Qt5 文件夹中。看起来qt3d工作正常,模块被识别为这样。
现在我想在 qt3d 文件夹中构建其中一个示例项目。更准确地说,我尝试构建 qt3d 茶壶示例。
C:Qtandroid-ndk-r9b/toolchains/arm-linux-androideabi-4.8/prebuilt/windows/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 -O2 -mthumb -Os -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -fno-exceptions -Wall -Wno-psabi -W -D_REENTRANT -fPIE -DQT_NO_PRINTDIALOG -DQT_NO_XKBCOMMON -DQT_NO_EXCEPTIONS -DQT_NO_DEBUG -DQT_3D_LIB -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -IC:QtQt5.1.15.1.1android_armv7mkspecsandroid-g++ -I..teapot -I......include -I......includeQt3D -IC:QtQt5.1.15.1.1android_armv7include -IC:QtQt5.1.15.1.1android_armv7includeQtOpenGL -IC:QtQt5.1.15.1.1android_armv7includeQtWidgets -IC:QtQt5.1.15.1.1android_armv7includeQtGui -IC:QtQt5.1.15.1.1android_armv7includeQtCore -I.mocrelease_shared -IC:Qtandroid-ndk-r9bsourcescxx-stlgnu-libstdc++4.8include -IC:Qtandroid-ndk-r9bsourcescxx-stlgnu-libstdc++4.8libsarmeabi-v7ainclude -IC:Qtandroid-ndk-r9bplatformsandroid-9arch-armusrinclude -I. -o .objrelease_sharedteapotview.obj ..teapotteapotview.cpp
C:Qtandroid-ndk-r9b/toolchains/arm-linux-androideabi-4.8/prebuilt/windows/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 -O2 -mthumb -Os -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -fno-exceptions -Wall -Wno-psabi -W -D_REENTRANT -fPIE -DQT_NO_PRINTDIALOG -DQT_NO_XKBCOMMON -DQT_NO_EXCEPTIONS -DQT_NO_DEBUG -DQT_3D_LIB -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -IC:QtQt5.1.15.1.1android_armv7mkspecsandroid-g++ -I..teapot -I......include -I......includeQt3D -IC:QtQt5.1.15.1.1android_armv7include -IC:QtQt5.1.15.1.1android_armv7includeQtOpenGL -IC:QtQt5.1.15.1.1android_armv7includeQtWidgets -IC:QtQt5.1.15.1.1android_armv7includeQtGui -IC:QtQt5.1.15.1.1android_armv7includeQtCore -I.mocrelease_shared -IC:Qtandroid-ndk-r9bsourcescxx-stlgnu-libstdc++4.8include -IC:Qtandroid-ndk-r9bsourcescxx-stlgnu-libstdc++4.8libsarmeabi-v7ainclude -IC:Qtandroid-ndk-r9bplatformsandroid-9arch-armusrinclude -I. -o .objrelease_sharedmain.obj ..teapotmain.cpp
C:QtQt5.1.15.1.1android_armv7binmoc.exe -DQT_NO_PRINTDIALOG -DQT_NO_XKBCOMMON -DQT_NO_EXCEPTIONS -DQT_NO_DEBUG -DQT_3D_LIB -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -IC:QtQt5.1.15.1.1android_armv7mkspecsandroid-g++ -I..teapot -I......include -I......includeQt3D -IC:QtQt5.1.15.1.1android_armv7include -IC:QtQt5.1.15.1.1android_armv7includeQtOpenGL -IC:QtQt5.1.15.1.1android_armv7includeQtWidgets -IC:QtQt5.1.15.1.1android_armv7includeQtGui -IC:QtQt5.1.15.1.1android_armv7includeQtCore -I.mocrelease_shared -IC:Qtandroid-ndk-r9bsourcescxx-stlgnu-libstdc++4.8include -IC:Qtandroid-ndk-r9bsourcescxx-stlgnu-libstdc++4.8libsarmeabi-v7ainclude -IC:Qtandroid-ndk-r9bplatformsandroid-9arch-armusrinclude -I. -I/usr/include -I/usr/local/include ..teapotteapotview.h -o .mocrelease_sharedmoc_teapotview.cpp
C:Qtandroid-ndk-r9b/toolchains/arm-linux-androideabi-4.8/prebuilt/windows/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 -O2 -mthumb -Os -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -fno-exceptions -Wall -Wno-psabi -W -D_REENTRANT -fPIE -DQT_NO_PRINTDIALOG -DQT_NO_XKBCOMMON -DQT_NO_EXCEPTIONS -DQT_NO_DEBUG -DQT_3D_LIB -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -IC:QtQt5.1.15.1.1android_armv7mkspecsandroid-g++ -I..teapot -I......include -I......includeQt3D -IC:QtQt5.1.15.1.1android_armv7include -IC:QtQt5.1.15.1.1android_armv7includeQtOpenGL -IC:QtQt5.1.15.1.1android_armv7includeQtWidgets -IC:QtQt5.1.15.1.1android_armv7includeQtGui -IC:QtQt5.1.15.1.1android_armv7includeQtCore -I.mocrelease_shared -IC:Qtandroid-ndk-r9bsourcescxx-stlgnu-libstdc++4.8include -IC:Qtandroid-ndk-r9bsourcescxx-stlgnu-libstdc++4.8libsarmeabi-v7ainclude -IC:Qtandroid-ndk-r9bplatformsandroid-9arch-armusrinclude -I. -o .objrelease_sharedmoc_teapotview.obj .mocrelease_sharedmoc_teapotview.cpp
C:Qtandroid-ndk-r9b/toolchains/arm-linux-androideabi-4.8/prebuilt/windows/bin/arm-linux-androideabi-g++ --sysroot=C:Qtandroid-ndk-r9b/platforms/android-9/arch-arm/ -Wl,-soname,libteapot.so -Wl,-rpath-link=C:/Qt/Qt5.1.1/5.1.1/android_armv7/lib -Wl,--no-undefined -Wl,-z,noexecstack -shared -o binlibteapot.so .objrelease_sharedteapotview.obj .objrelease_sharedmain.obj .objrelease_sharedmoc_teapotview.obj -LC:Qtandroid-ndk-r9b/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a -LC:Qtandroid-ndk-r9b/platforms/android-9/arch-arm//usr/lib -LC:/Qt/qt-3d/lib -lQt53D -LC:Qtandroid-ndk-r8e/sources/cxx-stl/gnu-libstdc++/4.7/libs/armeabi-v7a -LC:Qtandroid-ndk-r8e/platforms/android-14/arch-arm//usr/lib -lgnustl_shared -lsupc++ -llog -lz -lm -ldl -lc -lgcc -LC:QtQt5.1.15.1.1android_armv7lib -lQt5OpenGL -lQt5Widgets -lQt5Gui -lQt5Core -lGLESv2
16:19:28: The process "C:QtQt5.1.1Toolsmingw48_32binmingw32-make.exe" exited normally.
16:19:28: Elapsed time: 00:11.
现在我想为 android 部署该项目(点击箭头按钮)。部署到Android并不成功。没有生成APK文件,它只是失败。
mingw32-make: Nothing to be done for 'first'.
16:22:02: The process "C:QtQt5.1.1Toolsmingw48_32binmingw32-make.exe" exited normally.
16:22:02: Starting: "C:QtQt5.1.1Toolsmingw48_32binmingw32-make.exe" INSTALL_ROOT="C:Qtqt-3dexamplesqt3dteapotandroid" install
Die Syntax fr den Dateinamen, Verzeichnisnamen oder die Datentr„gerbezeichnung ist falsch.
makefile:1908: recipe for target 'install_target' failed
mingw32-make: *** [install_target] Error 1
16:22:04: The process "C:QtQt5.1.1Toolsmingw48_32binmingw32-make.exe" exited with code 2.
Error while building/deploying project teapot (kit: Android for arm (GCC 4.8, Qt 5.1.1)-Qt 5.1.1 for Android armv7)
When executing step 'Copy application data'
16:22:04: Elapsed time: 00:05
那么问题出在哪里呢?提前非常感谢...
问题出在包含 pri 的 Qt3D 示例专业文件中。我获取在 Android 上构建和部署的示例的方法是创建一个新的 Quick2 项目,只需将 qml 和其他资源复制到新的项目 qml 文件夹中即可。然后,如果您使用资产,则所有内容都会复制到APK中。如果要更快地加载,请将资源文件添加到项目中并添加所有现有文件,并在main中添加.cpp请更改为使用qrc:前缀来获取入口点qml文件。祝你好运!