2

I use Fluid qml library/plugin.

I installed the library using qmake and make, its installation path is in Qt/5.11.0/android_armv7/qml.

Find source tree is here.

There is a per-project installation example in it. I tried to modify its pro file to reduce APK size. Here is the pro file here.

I couldn't include the plugin in pro file while using ANDROID_DEPLOYMENT_DEPENDENCIES. This is what I tested.

Getting Error:

W/libsrc.so( 4200): (null):0 ((null)): QQmlApplicationEngine failed to load component W/libsrc.so( 4200): (null):0 ((null)): qrc:/main.qml:4 plugin cannot be loaded for module "Fluid.Controls": Cannot load library /data/data/org.qtproject.example.src/qt-reserved-files/qml/Fluid/Controls/libfluidcontrolsplugin.so: (dlopen failed: could not load library "libQt5Svg.so" needed by "libfluidcontrolsplugin.so"; caused by library "libQt5Svg.so" not found) W/libsrc.so( 4200):

Question:

How to include a specific plugin or library in pro file while using _ANDROID_DEPLOYMENT_DEPENDENCIES?

Nikhil Lotke
  • 605
  • 7
  • 15
Edip Ahmet
  • 465
  • 8
  • 18
  • Have a look at this question/answer: https://stackoverflow.com/questions/47061829/how-to-deploy-qt-imageformats-plugins-on-android/47072136#47072136 – Felix Apr 09 '18 at 12:22
  • Possible duplicate of [How to deploy Qt imageformats plugins on Android](https://stackoverflow.com/questions/47061829/how-to-deploy-qt-imageformats-plugins-on-android) – Felix Apr 09 '18 at 12:23
  • Thanks for answer. I tried the solution but this failed. It gave error: W/libfluid_deneme_optimized.so(24072): (null):0 ((null)): qrc:/main.qml:2 module "Fluid.Controls" plugin "fluidcontrolsplugin" not found – Edip Ahmet Apr 10 '18 at 01:38
  • Fluid *.so files are in [android-build/libs/armeabi-v7a/](https://paste.ubuntu.com/p/2SkMhJ9CnQ/) and [this](https://paste.ubuntu.com/p/PfKPDynZ4N/) is pro file. I also tried many combinations, like replacing it with ANDROID_EXTRA_LIBS. It always fails. Per project installation example works well without installing plugins. But it is apk size is too big, so I try to reduce it using ANDROID_DEPLOYMENT_DEPENDENCIES. There is also hello world example about it [here](https://github.com/edips/Minimal_QML_Android). – Edip Ahmet Apr 10 '18 at 01:44
  • 1
    when the files are in the build folder, have they been properly renamed? i.e. `libqml__.so` or `libplugins__.so` – Felix Apr 10 '18 at 07:47
  • Also, make shure all the `*.qml` files are place in the asset folder in `android-build/assets/--Added-by-androiddeployqt--/qml/` – Felix Apr 10 '18 at 07:51
  • No I didn't renamed them. Fluid *.so files start with "libFluid". Another plugins start with libqml or libplugin. Maybe the problem is about this. I looked in system data folder of rooted Android device. There are Fluid Qml libs in qml folder and there are Material design, QQC2 QML files in it. – Edip Ahmet Apr 10 '18 at 11:25
  • I will compare asset folder of APK files between working Fluid example and edited example. I will report differences here. – Edip Ahmet Apr 10 '18 at 11:28
  • Felix thanks for the idea, I solved it now. I looked asset folder, and I realized plugin names are different from working example's plugin names. It wasn't about ANDROID_EXTRA_LIBS or ANDROID_EXTRA_PLUGINS. – Edip Ahmet Apr 10 '18 at 22:56
  • Just as sidenode: When using `ANDROID_EXTRA_PLUGINS` the renaming is done automatically, so you don't have to take care of it, as long as the plugins are in the correct location – Felix Apr 10 '18 at 22:58
  • When I tried ANDROID_EXTRA_PLUGINS Fluid plugin names were different, it started with "Fluid" instead of "libplugins__.so" or "libqml__.so". So I deleted it and included *.so and other files in ANDROID_DEPLOYMENT_DEPENDENCIES. It worked. – Edip Ahmet Apr 10 '18 at 23:01

1 Answers1

1

I assumed including qmldir, *.so files and *.qmltypes files will include QML files automatically. It didn't work. I edited the pro file again. Then I included required Fluid QML files seperately, it worked! here is the pro file. The APK size reduced from 47MB to 37MB using ANDROID_DEPLOYMENT_DEPENDENCIES.

Edip Ahmet
  • 465
  • 8
  • 18