Porting Qt(C++) and qml application to Android platform

Skip to first unread message

Syed Aftab Naqvi

May 16, 2017, 1:10:03 PM5/16/17
to android-qt

I am porting Qt(C++) and qml based app to Android platform. I am not using Qt Creator because of the nature of the project.

I have done compiling the code using ndk and generated all the required .so files for my C++ components. Created the project in Android studios, included the jiniLibs(*.so) files, alos, used Qt provided Activity/Loader/Delegate classes and to write Android app. App loads the "main.so" and application get started. I can see the logs which tells me that its loaded. I have created QGuiApplication object and while creating QmlComponent, I am trying to pass main.qml into QmlComponent instance within main.so but I don't know how to specify the path of main.qml?

I tried qrc:/main.qmlassets:/main.qml but no luck.

NOTE: I placed my main.qml in assets folder. I am not even sure where to put that file while packaging.

Looking for suggestions, how do we specify assets/resource paths inside C++ code. In future, I need load many other resources.




Jul 21, 2017, 7:13:26 PM7/21/17
to android-qt

I tried qrc:/main.qmlassets:/main.qml but no luck.

Why don't you put your QML files in a Qt resource file, and add the *.qrc file to your *.pro file? (See Qt Resource System).
Then you should be able to access it like so:

":/main.qml" or "qrc:///main.qml" (both are equivalent)

This is how I do it, and it works just fine.

Syed Naqvi

Jul 21, 2017, 7:19:03 PM7/21/17
to android-qt

Thanks for your response. I don't have .pro file. I am using cmake to build the project but I was able to map it.

Thanks again for your help.

From: andro...@googlegroups.com <andro...@googlegroups.com> on behalf of polos...@gmail.com <polos...@gmail.com>
Sent: Friday, July 21, 2017 4:13 PM
To: android-qt
Subject: Re: Porting Qt(C++) and qml application to Android platform
You received this message because you are subscribed to a topic in the Google Groups "android-qt" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/android-qt/mdsMIeFJw4Q/unsubscribe.
Google Groups allows you to create and participate in online forums and email-based groups with a rich experience for community conversations.

To unsubscribe from this group and all its topics, send an email to android-qt+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
0 new messages