[Interest] Qt 5.3.0 QML Android: how to deploy custom c++ plugin directory structure

Frédéric Martinsons frederic.martinsons at sigfox.com
Tue Jul 29 08:18:56 CEST 2014


Hello, for those who are interested, I finally managed to get deploy my
custom c++ plugin without any modifications on resources files. I simply
re-read the documentation carefully (
http://qt-project.org/doc/qt-5/deployment-android.html) and especially the
paragraph about res/vaues/libs.xml. So my source tree is like the
following:
MyProject/
       android/
           AndroidManifest.xml
           assets/
               qmldir
           res/
               values/
                   libs.xml
       MyBinary/
       MyPlugin/
            libMyPlugin.so
            qmldir

I simply override part of libs.xml with the following line and use "Bundle
Qt libraries in APK" option in Qt Creator deployment configuration:

   <array name="bundled_in_lib">
      <item>libMyPlugin.so:qml/MyPlugin/libMyPlugin.so</item>
        <!-- %%INSERT_BUNDLED_IN_LIB%% -->
    </array>
    <array name="bundled_in_assets">
      <item>qmldir:qml/MyPlugins/qmldir</item>
        <!-- %%INSERT_BUNDLED_IN_ASSETS%% -->
    </array>

With these I'v got the right directory structure after the first launch on
device in  "/data/data/com.company.app/qt-reserved-files/lib/qml" and in my
main.qml the "import MyPlugin" directive is finally resolved.

Great !

Thank you for your answers.




2014-05-27 6:13 GMT+02:00 Frédéric Martinsons <
frederic.martinsons at sigfox.com>:

> Ok then, I'll give it a try. It's prettier than my first method. Thanks
> Le 27 mai 2014 00:52, "Preet" <prismatic.project at gmail.com> a écrit :
>
> On Sun, May 25, 2014 at 1:58 AM, Frédéric Martinsons
>> <frederic.martinsons at sigfox.com> wrote:
>> > I'm not sure to understand completely. You reproduce the directory
>> structure
>> > after the build phase of your plugin in the qrc, build it manually and
>> copy
>> > it to the android data dir ? Or you simply embed an archive of the
>> directory
>> > and extract it on the first run at the right place ?
>>
>> The first method. The plugin is built and copied to the build folder.
>> A qrc is also copied to the build folder such that when I build my
>> application, I can include that qrc and have the plugin be embedded as
>> a resource all in one go. Then I just extract it on first run.
>>
>> Preet
>> _______________________________________________
>> Interest mailing list
>> Interest at qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/interest
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20140729/91c739b9/attachment.html>


More information about the Interest mailing list