Ubuntu Touch: Building and testing a QML extension
December 16, 2013 Leave a comment
I found myself trying to build a QML Ubuntu Touch app project that includes a qml c++ extension and I found that I some how stumble a bit along the way. So, here are some of my notes on how I got it done. Hope that helps.
Creating the project.
Using QtCreator, create a new project and select – QML Extension Library + Tabbed Touch. I found that it was easier to change the QML side of things than start with an extension and then add the whole project structure.
Build and Run your project locally
In QtCreator click on projects. In Build, I set up the build path as my project root path. In run, the executable is “/usr/bin/qmlscene” (make sure there is no spaces trailing) and then Arguments is set to “-I ../backend/modules $@ yourapp.qml”, with a working directory of “projectroot/app”
Now if you try to run your project it should build it locally and run your app. After that you are on a roll.
Build on target device
Click Ctrl+f11 should install the platform developer tools in your device. However, I how found that this lately does not work.
Instead from the terminal:
first we will need to make the image in your device writeable:
adb shell touch /userdata/.writable_image --> and reboot the phone.
Now you are ready to build, so back to QtCreator:
Build>Ubuntu>Build Application on Device
This should build the application with only some test problems, but the main binaries would be created. To package your app you will need to get
Creating a click package
create a manifest standard manifest file. Manifest.json
"description": "your text",
"maintainer": "your name<firstname.lastname@example.org>",
You will also need a yourapp.desktop file:
Exec=qmlscene -I plugin $@ yourapp.qml
Note that Exec= has a -I plugin part to it. This is very important, will see later.
Now yourapp.json file that contains your confinement profile:
Now time to setup a folder with all this stuff, not that the plugin folder is going to contain your lib which your are importing with -I option on the desktop file:
Now you are ready to build from your project root folder:
click build ./click
This should create a .click file in your project folder.
Installing in your device
adb pull your.click /home/phablet/
pkcon -p install-local your.click
This should be enough, but sometimes I find that you need to restart unity:
pkill unity8 (you might need sudo)