.pro文件中的未知模块-无法使用androidextras模块构建应用

内核恐慌

我正在开发一些Qt / QML应用程序,该应用程序将部署到Android OS。现在,我需要模块androidextras,但如果我把androidextras我的内部.pro文件,如下所示

QT += qml quick widgets sql core bluetooth printsupport androidextras

我重新运行qmake,出现以下错误:

项目错误:QT中的未知模块:androidextras

我还尝试打开并运行示例项目Qt Notifier,但发生相同的错误,因此我无法构建应为开箱即用的应用程序或示例。

我使用KUbuntu 15.04gcc version 4.9.2 (Ubuntu 4.9.2-10ubuntu13)编译器和Desktop Qt 5.5.0 GCC 64bitQt的版本。如何建立这个androidextras模组?Android arm v7从维护工具屏幕截图中可以看到,我已经安装了套件:

在此处输入图片说明

我用重新编译了整个Qt clear && ./configure -opensource -confirm-license -verbose -cups -plugin-sql-mysql -android-sdk /opt/android-sdk-linux -android-ndk /opt/android-ndk-r10d && make && make install,在QtCreator中设置了Qt版本和Qt Kit,更改了构建工具,仍然弹出相同的错误。为什么?

巴卡罗佐

Extras模块旨在提供特定于某个平台的附加功能,因此在该平台上可用它可能是iOS应用上的徽章数量的支持,到Windows跳转列表或者一些实用功能的支持,从一个类型转换为相应的本机平台类型(例如QPixmapCGImageRef,又在苹果演员)。

There exist four extras modules - Win, Mac/iOS, X11, Android - and as long as you compile for the specific chosen platform against the specific kit, everything is fine. And it's also automatic, for desktop environment: your host machine is always your target machine.

Mobile kits are instead used to cross-compile from a certain (desktop) host machine to another (mobile) target machine. In this settings you can easily (and erroneously) compile platform specific code with the wrong kit.

Generally speaking, you should put platform specific modules/code inside conditionals to ensure that it is compiled only against the specific kit for which they are available. That's especially true for software which must be compiled both for desktop and mobile platforms or across different desktop platforms. Conditional in .pro file could look like this:

android: QT += androidextras
mac: QT += macextras
// ...other platform specific and platform independent  settings

See this answer for an android .pro example file which includes also manifest specific settings.

The same approach should be followed in code, i.e. check the OS and conditionally compile the platform code. For instance a multi-platform implementation of a function could look like this:

if defined(Q_OS_ANDROID)
#include <QtAndroid>
#include <QAndroidJniObject>
#endif

// other code...

void YourClass::function()
{
#if defined(Q_OS_ANDROID)
// platform code
#elif defined(Q_OS_WIN)

#endif
}        

例如,有关完整的Android示例,请参见此答案对于某些有用的iOS特定关键字,请参见此其他答案

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

在多个应用程序模块中重复使用proguard-rules.pro文件

无法在多口味应用中构建功能模块

应用程序无法使用模块的模块

错误:distutils扩展模块中的未知文件类型“ .hpp”

使用.aar模块的Flutter插件可以在示例应用程序中构建并正常运行,但无法在其他应用程序中构建

无法构建bsdiff模块

Webpack构建Angular.js-无法实例化模块应用

添加Swift文件后构建Swift Cocoa Touch框架时出错:<未知>:0:错误:无法构建Objective-C模块

使用jpackage构建独立的可安装模块应用程序

使用 netbeans 模块构建独立应用程序

node_modules文件夹中的许多未知模块

无法使用 node.js 中的应用程序从扩展模块调用基本模块

导入模块后,Android项目无法使用Gradle构建

无法使用sasl python模块构建docker映像

使用Webpack构建Gatsby组件无法转换Gatsby模块

无法使用链接的本地节点模块构建项目

使用NFS模块构建的initrd无法挂载NFS根目录

无法构建目标 c 模块

项目错误:QT中的未知模块:图表

项目错误:QT中的未知模块:蓝牙

QT中的未知模块:声明性的

Qt:3danimation中的未知模块

注册模块中的vuex未知突变类型

Omnet ++模块错误中的未知参数

项目错误:QT中的未知模块:脚本

在Android Studio和Gradle中的Android应用程序模块中使用库模块的不同构建类型

Verilog中的未知模块错误,但模块已存在

C# 使用未知模块中的互操作未处理的“System.IO.FileNotFoundException”加载 Excel 文件

Mac Pro中的混合RAM模块