Jump to content

Necessitas/QuickStartDevelop: Difference between revisions

From KDE Community Wiki
Jra (talk | contribs)
Jra (talk | contribs)
 
Line 45: Line 45:
Also on the Run view you can set the Deploy Configurations, by selecting Details at the right hand side these are the different options you can choose between.
Also on the Run view you can set the Deploy Configurations, by selecting Details at the right hand side these are the different options you can choose between.


# ''Use device's qt libs''
# Use device's qt libs
# ''Deploy local qt libs''
# Deploy local qt libs
# ''Install Ministro system''
# Install Ministro system
 
====Use device's qt libs====


The Use devices qt libs option depends also on the Use local qt libs option. When Use local qt libs is unchecked your application will need the Ministro package to run. However if Use local qt libs is checked, Qt Creator will pass special parameters to the application, forcing it to use Qt libraries from the /data/local/qt path on the device.
The Use devices qt libs option depends also on the Use local qt libs option. When Use local qt libs is unchecked your application will need the Ministro package to run. However if Use local qt libs is checked, Qt Creator will pass special parameters to the application, forcing it to use Qt libraries from the /data/local/qt path on the device.
====Deploy local qt libs====


The Deploy local qt libs option makes Qt Creator deploy qt libs found in the Qt SDK chosen (e.g. android-lighthouse-4.8.0). This option is useful when you hack on the Qt framework to test it.
The Deploy local qt libs option makes Qt Creator deploy qt libs found in the Qt SDK chosen (e.g. android-lighthouse-4.8.0). This option is useful when you hack on the Qt framework to test it.
This option automatically selects the ''Use local qt libs option''. This option get automatically unchecked after Qt Creator pushes the Qt libs. This option can be checked every time you need to push your local Qt modifications.  
This option automatically selects the ''Use local qt libs option''. This option get automatically unchecked after Qt Creator pushes the Qt libs. This option can be checked every time you need to push your local Qt modifications.  


====''Install Ministro system''====
Install Ministro system option installs the Ministro package (you must provide the apk yourself; download it from from [http://files.kde.org/necessitas/installer/release/Ministro%20II.apk here]). It is useful when you try to test your application on Android Virtual Devices.
 
This is the default for new projects.
 
Install Ministro system option installs the Qt libraries using the Ministro package (you must provide the apk yourself). It is useful when you try to test your application on Android Virtual Devices. You can get the Ministro .apk from [http://files.kde.org/necessitas/installer/release/Ministro%20II.apk here]. To install it, run "$NECESSITAS_DIR/android-sdk/platform-tools/adb install Ministro II v8.9.2.apk".


== Conclusion ==
== Conclusion ==


You are done, you can now enjoy the development phase. :) You can build and run your application on the device. You will notice that the application output is forwarded to Qt Creator and that you can get interesting debugging information there, plus you can also set breakpoints.
You are done, you can now enjoy the development phase. :) You can build and run your application on the device. You will notice that the application output is forwarded to Qt Creator and that you can get interesting debugging information there, plus you can also set breakpoints.

Latest revision as of 16:36, 1 March 2013

Developing with Necessitas (Quickstart)

There are multiple ways to develop Qt Applications for Android, the easiest one is to use Qt Creator For Android (included into the Necessitas SDK) enabling you to deploy, run and debug Qt and your Qt application on the device.

Although if you are more used to the CLI using an advanced text editor, or if you want to use another IDE the necessitas framework provides you scripts you can use to manage your Qt for Android projects. Both ways are explained in the subchapters.

Using Qt Creator

Qt Creator is a first class IDE for developing Qt Applications with the different tools it provides. Developing a Qt Application for Android with the Qt Creator provided in the Necessitas framework lets programmers be productive and enjoy Android application development in C++.

Create a new Qt C++ Project

Create a new Qt C++ Project, this can either be a Qt Gui Project or a Qt Mobile Application (in this case you will have to remove the body of MainWindow::setOrientation generated by Qt Creator, which contains references to Qt For Symbian). OF course you can use your existing project, if you have already one!

Choose the Qt Version

Once you have chosen the project name QtCreator will ask you which Qt version to use. It should propose by default those you configured: android-lighthouse-4.8.0 debug & android-lighthouse-4.8.0 release. Check them if they aren’t already selected and deselect any other Qt versions which are available.

Project setup

Select Android version

When your project is created, you are almost done, you will just need to select which android version you are targeting and how you want to deploy the Qt Libs onto the device. Just keep in mind that Android Gingerbread (2.3) is the minimum release supporting debugging. At least Android 2.2 should be selected. Android-4 API level is the only one which doesn’t support multitouch, so if your application needs multitouch you have to chose a higher one.

Check the Projects View

Click on the Projects view (the icon is located on the left hand side of the QtCreator window): Qt for Android Integration adds two views here: Build & Run which appear in a small box towards the top of the main window, clicking on Build or Run swaps between the Build and Run views within the Project View.

In thehe Run View you will have to do the most settings.

  1. Manifest Tab

You can choose a Package name for your application, indeed the application is launched by an automatically generated java launcher, which will be packaged with your application in an .apk (more information about the .apk: Android Application Fundamentals), and an apk has to be in a package.

  1. Application Tab

On the Application tab you can choose an icon for your application and set the application's name.

  1. Permissions Tab

With the Permissions tab you can pick which permissions are needed for your application, so that the people installing it, will know what it will do, and that the Android OS will give your application access to the required features. This is probably the most important tab here, please make sure you select all the applicable permissions, or your app will not even start!

  1. Libraries Tab

The Libraries tab will offer you an automatic way to determine which Qt libraries you use! Or if needed let you select manually the Qt libraries and the external libraries you think your application needs. These entries will be used by the Ministro tool to determine which Qt libraries have to be downloaded.

Deploy Configurations

Also on the Run view you can set the Deploy Configurations, by selecting Details at the right hand side these are the different options you can choose between.

  1. Use device's qt libs
  2. Deploy local qt libs
  3. Install Ministro system

The Use devices qt libs option depends also on the Use local qt libs option. When Use local qt libs is unchecked your application will need the Ministro package to run. However if Use local qt libs is checked, Qt Creator will pass special parameters to the application, forcing it to use Qt libraries from the /data/local/qt path on the device.

The Deploy local qt libs option makes Qt Creator deploy qt libs found in the Qt SDK chosen (e.g. android-lighthouse-4.8.0). This option is useful when you hack on the Qt framework to test it. This option automatically selects the Use local qt libs option. This option get automatically unchecked after Qt Creator pushes the Qt libs. This option can be checked every time you need to push your local Qt modifications.

Install Ministro system option installs the Ministro package (you must provide the apk yourself; download it from from here). It is useful when you try to test your application on Android Virtual Devices.

Conclusion

You are done, you can now enjoy the development phase. :) You can build and run your application on the device. You will notice that the application output is forwarded to Qt Creator and that you can get interesting debugging information there, plus you can also set breakpoints.