how to add import qml module to deploy

2,766 views
Skip to first unread message

qtnext

unread,
Nov 11, 2011, 4:50:16 PM11/11/11
to android-qt
Hi,

my apps use custom components module (a fully qml and javascript
package). I have on Windows this package distribute in the root folder
of my apps (appfolder\Qt\labs\components\custom\..)
I don't know how to add this folder in the package to deploy to device :
I have tryed INSTALLS+ ,deployments, ... but nothing works

Koying

unread,
Nov 12, 2011, 1:29:41 AM11/12/11
to andro...@googlegroups.com
The (only?) way to go is to package your qml/js into a resource file.
You can then access them via a "qrc:/" url.

qtnext

unread,
Nov 12, 2011, 3:01:16 AM11/12/11
to andro...@googlegroups.com
Le 12/11/2011 07:29, Koying a écrit :
> The (only?) way to go is to package your qml/js into a resource file.
> You can then access them via a "qrc:/" url.

the probiem is that is a qml module (qmldir +js + qml .. no C++) and I
call it in my application in several folders level with import
Qt.labs.components.custom 1.0 . regarding qt lists it seems it's not
possible to embed qml module in qrc.
If there is no automatic deployement method, is there a way to manually
copy files in the folder tree use to create the apk ?

qtnext

unread,
Nov 12, 2011, 3:31:07 PM11/12/11
to andro...@googlegroups.com
I have tryed to embed qml module in ressource but it don't works (tryed on windows to test).
It seems that in alpha 3 there is  "seamless assets support" : is it what I need to do ? how can I add module in assets if it's that ?

best regards,


Le 12/11/2011 07:29, Koying a écrit :

qtnext

unread,
Nov 12, 2011, 5:36:43 PM11/12/11
to andro...@googlegroups.com
Le 12/11/2011 07:29, Koying a écrit :
The (only?) way to go is to package your qml/js into a resource file.
You can then access them via a "qrc:/" url.
import 'qrc:/Qt/labs/components/custom' works ... but it's not the best, i need to embed in qrc the qml module.

BogDan Vatra

unread,
Nov 13, 2011, 1:49:41 PM11/13/11
to andro...@googlegroups.com
Yes, this is what you need, check [1], or even better create a new qml
application and check the source code to see how it works.

[1] http://techbase.kde.org/Development/Tutorials/Necessitas

Cheers,
BogDan.

2011/11/12 qtnext <qtn...@gmail.com>:

Koying

unread,
Nov 23, 2011, 11:49:55 AM11/23/11
to andro...@googlegroups.com
Hi,

Could it be that there is an issue loading QML C++ plugins from assets?

 I get:

D/Qt      ( 7240): QDeclarativeImportDatabase::addImportPath: "/tmp/necessitas/unstable/Android/Qt/480/build-armeabi/install/imports"
D/Qt      ( 7240): QDeclarativeImportDatabase::addImportPath: "/data/local/qt/imports"
D/Qt      ( 7240): QDeclarativeImportDatabase::addImportPath: "."
D/Qt      ( 7240): QDeclarativeImportDatabase::addImportPath: "/imports/"
D/Qt      ( 7240): QDeclarativeImports(file:///qml/main.qml)::addImport: "." -1.-1 File as ""
D/Qt      ( 7240): QDeclarativeImports(file:///qml/main.qml)::addImport: "QtQuick" 1.0 Library as ""
D/Qt      ( 7240): QDeclarativeImports(file:///qml/main.qml)::addImport: "com.nokia.android" 1.1 Library as ""
D/Qt      ( 7240): QDeclarativeImports(file:///qml/main.qml::importExtension: loaded "/imports/com/nokia/android.1.1/qmldir"
D/szipinf ( 7240): Initializing inflate state
D/Qt      ( 7240): QDeclarativeImportDatabase::importPlugin: "com.nokia.android" from "/imports/com/nokia/android.1.1/libandroidplugin_1_1.so"

W/Qt      ( 7240): file:///qml/main.qml:3:1: plugin cannot be loaded for module "com.nokia.android": Cannot load library /imports/com/nokia/android.1.1/libandroidplugin_1_1.so: (Cannot load library: load_library[1104]: Library '/imports/com/nokia/android.1.1/libandroidplugin_1_1.so' not found)
W/Qt      ( 7240):      import com.nokia.android 1.1
W/Qt      ( 7240):      ^

"assets/imports/com/nokia/android.1.1/libandroidplugin_1_1.so" exists, as is "assets/imports/com/nokia/android.1.1/qmldir", in the apk...

BogDan Vatra

unread,
Nov 24, 2011, 1:53:02 PM11/24/11
to andro...@googlegroups.com

Koying

unread,
Nov 24, 2011, 6:26:07 PM11/24/11
to andro...@googlegroups.com
Yes, I already read this. Loading of .qml, .js and images works fine. Only the c++ .so plugin does not load.

I think this is specific to executables in assets. The .so file is actually found (It's another message if it is not), the logcat says it cannot be "loaded", which I understand as "cannot be executed".

- Chris -

CMGeorge

unread,
Jan 18, 2012, 4:45:38 AM1/18/12
to android-qt
Hi guys.

My first post, hope will be helpful

@Koying
Running ./arm-linux-androideabi-readelf -d ~/Qt/Android/AxA/AxA/qml/
plugins/libandroidplugin_1_1.so
I find the next dependency structure:
0x00000001 (NEEDED) Shared library:
[libQtDeclarative.so]
0x00000001 (NEEDED) Shared library:
[libQtScript.so]
0x00000001 (NEEDED) Shared library: [libQtSql.so]
0x00000001 (NEEDED) Shared library:
[libQtXmlPatterns.so]
0x00000001 (NEEDED) Shared library: [libQtSvg.so]
0x00000001 (NEEDED) Shared library: [libQtGui.so]
0x00000001 (NEEDED) Shared library:
[libQtNetwork.so]
0x00000001 (NEEDED) Shared library:
[libQtCore.so]
0x00000001 (NEEDED) Shared library:
[libQtSystemInfo.so]

After you will check all those libraries as required and make a clean/
build, the libraries will must work.

Best regards,
George Calugar

CMGeorge

unread,
Jan 18, 2012, 4:46:36 AM1/18/12
to android-qt
Ups, ignore the post date :)

PAT

unread,
Aug 20, 2013, 3:08:37 AM8/20/13
to andro...@googlegroups.com
Just figured out, that a subfolder, which you may import, must be written with capital:

import 'subfolder" --> ERROR
import 'Subfolder' --> OK

and when the 'Subfolder' is in the 'projectName/qml/Subfolder/' path, it gets copied automatically to the device! (because it is added do DEPLOYMENTFOLDERS in the .pro)
Reply all
Reply to author
Forward
0 new messages