[Interest] Including Qt Quick 2 extension plugin in Android App

René Hansen renehh at gmail.com
Thu Oct 4 22:38:41 CEST 2018

Hi everyone,

I can't seem to get the voodoo right on something that should be trivial.

My use case is this; I have two Android apps, which uses similar logic that
I'd like to extract and share between them, in the form of an extension
plugin. Easy peasy right? Well, I just can't seem to figure it out.

In order to distill my understanding of how this is supposed to work I've
created a simple example in this repo:


All I've done is the following:

1. Generated the default Qt Quick Controls 2 Swipe app.
2. Generated the default Qt Quick 2 extension plugin.
3. Added a custom QML invokable method, "foo()" on the default "MyItem".
4. Updated the App.pro file, and specified the extension's install path,
(Maybe incorrectly), to the QML_IMPORT_PATH

I get the autocompletion inside QtCreator for "MyItem" and no import errors
in the editor, so something must be right.

However... as soon as I run the App, i get:

W libApp.so: (null):0 ((null)): QQmlApplicationEngine failed to load
W libApp.so: (null):0 ((null)): qrc:/main.qml:4 module
"com.mycompany.qmlcomponents" is not installed

The extension build folder looks like this after a build:

├── Makefile
├── android-build
│   ├── Users
│   │   └── rene
│   │       └── Code
│   │           └── Qt
│   │               └── 5.11.1
│   │                   └── android_armv7
│   │                       └── qml
│   │                           └── com
│   │                               └── mycompany
│   │                                   └── qmlcomponents
│   │                                       └── qmldir
│   └── libs
│       └── armeabi-v7a
│           └── libExtension.so
├── extension_plugin.o
├── libExtension.so
├── moc_extension_plugin.cpp
├── moc_extension_plugin.o
├── moc_myitem.cpp
├── moc_myitem.o
├── moc_predefs.h
├── myitem.o
└── qmldir

Even so, libExtension.so isn't included in the .apk after building the app.
I can get it included by adding ANDROID_EXTRA_LIBS += <path
to>/libs/armeabi-v7a/libExtension.so, to App.pro, but that doesn't change
the above error.

I've tried pointing ANDROID_EXTRA_PLUGINS to various locations of the
extension's install folder as well, but that just seems to dump everything
underneath the specified path, directly into assets...

Can anyone tell me, how on earth is this supposed to work? Am I just using
the wrong paths, or am I missing something fundamental here?

/René Hansen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20181004/d2b3dd74/attachment.html>

More information about the Interest mailing list