简体   繁体   中英

Qt, Qml and C++ based application porting to Android

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.qml , assets:/main.qml but no luck.

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

Looking for suggestion, how do we specify assets/resource paths inside C++ code.

// QQmlEngine* m_pQmlEngine;
m_pQmlEngine->setBaseUrl("qrc:/qml/");

Qt Android帮助程序类复制/data/data/org.qtproject.example.test/qt-reserved-files/路径中的所有资产,但您需要确保资产信息应映射到res/values/libs.xml中有一节

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM