If you have not already installed your environment, please refer to the “Ubuntu SDK Installation” section to install your own SDK environment. The main purpose of this article is to check that our installed environment is correct to ensure that it is correct. Watch the video “How to Use The Ubuntu SDK” to learn more about this chapter.

\

1) Create a simple QML application

  • Start the Ubuntu SDK
  • Select menu “File” ==> “New File or Project”
  • “App with Simple UI”

\

\

  • Select “Choose” and then select the name of the project you want to create as follows:

\

\ \

\

\

\

During creation, ensure that the Maintainer format is correct. Otherwise, problems may occur during future compilation.

  • Then accept the default Settings and a simple QML should be done. As follows:

\

\

Open the manifiest. Json file and check that the framework is set to “Ubuntu-SDK-14.10”. This is the framework currently supported on mobile phones and emulators. If the phone or emulator does not support the framework we have chosen, our application will not be installed. We can check the framework supported by our phone or emulator (while the emulator is running) by:

\

\

\

\

2) Run it on your Desktop

\

We can select the green triangle button in the lower left corner of the IDE or press Ctrl + R at the same time. This allows us to run the application on our Desktop by default. If we can see the following screen, it means that there is no problem with our installation.

\



\

3) Run the application on the emulator

\

To be able to run our application on the emulator, we can do as follows:

  • Start the Ubuntu SDK
  • Select “Devices” on the left side of the IDE and also select the emulator we have created (I created MyInstance earlier). Also click the green button in the picture to start the emulator.

\

\

  • Returning to our previous interface, if the emulator Kit was not selected when creating the project, we can add it as follows:

\

  • At the same time, we set the emulator Kit for selecting the lucky row

\

  • Use the shortcut key Ctrl + R or click the triangular Run button at the bottom left of the screen. So we can see something like this:

\


\

If we see this, we can assume that our simulator environment is fine. We can then make the application run on the phone.

\

3) Run it on your phone

* * * *

In order to run the app on our phones, we first had to connect our phones to our development computers. First we had to turn on the “developer mode” on the phone. See my other article on how to open developer mode on an Ubuntu phone for more details.

\

We can go through the following steps:

  • Start the Ubuntu SDK
  • Click “Devices” on the left side of the IDE and also click “Ubuntu Device” (this is the default name, which can be changed). Then we will see the following screen in the Qt Creator IDE
  • Click the “AutoCreate” button to install the Device Kits. This process may take some time and requires patience
  • Keep “Ubuntu Device” as the currently selected Device

\



\

  • Return to the project page. If we did not select the Kit of the phone when creating the app, we can add it in the following way

\

  • Also select the Kit at run time

\

  • Use the shortcut key Ctrl + R or press the Run button (the green triangle button) at the bottom left of the screen. This allows you to see the application in action on your phone.

\

\

  • Press the red square button in the “Application Ouput” window to terminate the Application on the phone:

\

\

\

4) Create an “App with QML Extension Library” application

\

Now let’s create an application with QML Extension Libray and run it:

\

\

\

\

\

We choose the default Settings until we get to the following screen:

\



\

Check “Ubuntu Device (GCC armHF-Ubuntu-SDK-14.10-UTOPic)” so you can run it on your phone in the future. If it is not selected during creation, you can select “Projects” and” Add Kit” on the main screen.

\



\

To make the application run in the emulator:

  • Click “Devices”, then click on the emulator you created earlier (myInstance in my case)
  • Click the green button in the emulator to start the emulator
  • If “Device Kits” is not added, click the “AutoCreate” button to install. If the corresponding chroot is not installed during this period, you will be prompted to install the corresponding chroot. If so, the installation process may take some time. Please be patient

\



\

* * * *

For developers switching to another phone midway, please find the corresponding Device (” Has Network Connection “has a check box after the phone is connected to the computer) and click” Autocreate “tocreate the corresponding Device Kits. Otherwise, we have no way to deploy applications to our phones. In short, every mobile phone has its Kits, which are not the same as those of other mobile phones.

* * * *

  • After the “Device Kits” are installed, this screen looks like this:



\

  • Go back to the Projects screen and click “Add Kit”. Check just created “Myinstance (GCC i386-Ubuntu-SDK-14.10-UTOPic)” (this name may be different from your own choice)
  • Select the desktop icon in the lower left corner of the IDE, and then select a different architecture to run. For emulator architecture, select “MyInstance (GCC i386-Ubuntu-SDK-14.10 – UTOPic)”. This will allow the application to run in the emulator
  • \

5) How do I import a project and run it

\

As we know, our SDK currently supports two types of project files:

  • Project files with a. Qmlproject suffix, such as “Flickr. Qmlproject”. This applies to pure QML/Javascript projects with no C++ code. Currently in the SDK, “App with Simple UI” and” App with Tabbed UI” are such projects
  • Project file with “cmakelists.txt”. Such projects are usually projects with C++ code

For any project, we simply need to open the project’s project file to import the entire project. Specific operations are as follows:

\

\

\

We can also use the hotkey Ctrl +O.

\

\

\

\

Once the project is imported, we can run our application directly under different architectures as we did earlier. If a schema is not added, we can add it using the following method:

\

\

\

\

\

Once we have selected our architecture, we can press the green button in the lower left corner of the IDE or the hot key Ctrl + R.

* * * *

支那

支那

\

The image above shows the application we want to run on our mobile platform architecture (ARMHF).

\

6) Compile and run our Core Apps

If you are interested in the Ubuntu OS Core Apps, please refer to the article “How to Compile and install Ubuntu OS Core Apps” to compile and run them.

\

In conclusion, in this article, we explained how to create a basic application and how to run it in different frameworks. By doing this, we can verify that our installation environment is correct and get familiar with the entire operating environment. In the next section, we’ll show you how to generate a Click installation package and install it on your phone. For developers who want to deploy their applications to mobile phones, read the article “How to Install Ubuntu on Device”.

\