Btoe co uk How-To Install Qt for Android on



Download 28.87 Kb.
Date25.06.2017
Size28.87 Kb.
#21826

btoe.co.uk




How-To

Install Qt for Android

on

Xubuntu LTS (64-bit)



v.1.0

17th Dec 2014

by

btoe.co.uk

Contents


Introduction 3

Downloading the required files 3

Android SDK 3

Android NDK 3

Qt 4

Linux Setup 4



Library dependencies 4

Android 4

Java 4

Ant 4


Android Setup 5

SDK 5


Extract SDK 5

Prerequisites 5

Install SDK 5

SDK Update 5

SDK API & Images Setup 6

Creating Virtual Android Devices 6

Test the Device 7

NDK 7


Qt Setup 7

Dependencies 7

Emulator 7

Installing Qt 7

Configuring components 8

Qt Creator Setup 8

Running a Qt Example 8

Final Note 9





Introduction


In this How-To and it companion video on YouTube, shows you how to install Qt for Android and Desktop development on Xubuntu. We highly recommend the use of a LTS version of Ubuntu. We will use XUbuntu 14.04 LTS (64-bit). This How-To assumes a fresh install of XUbuntu, with the latest updates.

At the end of this How-to, we build an example application, and deploy it to a virtual android device.


Assuming a fresh install of Xubuntu, let’s first check the Linux version and the machine type.

In the command prompt we type:

lsb_release –a


No LSB Module are available.

Distributor ID: Ubuntu

Description: Ubuntu 14.04.1 LTS

Release 14.04

Codename: trusty

uname –m



x86_64

Downloading the required files


Lets first download all the required files.

Open a browser at www.qt.io

Now we navigate to the Developer’s page to read the desktop installation instructions.

Click Developers page

Click Installation (in Get Started)

Click Android


Android SDK


Navigate to Android SDK

Click ‘Other download options’

Click to download android_sdk_rxx.tgz and save.

Android NDK


Navigate to Android NDK

Click android-ndk-r-linux-x86_64.bin

Accept the T&C’s

Click Download


Qt


Downloading the Qt online installer:

Open a browser at www.qt.io

Click Download. Here we will use the community edition for this demonstration.

Click Download under Community Edition (or edition required)

Click Download Now

Click Save file.


Linux Setup


Let’s start by making sure all the prerequisites are installed for Qt (Desktop)

Open a browser at www.qt.io

Now we navigate to the Developer’s page to read the desktop installation instructions.

Click Developers page

Click Installation (in Get Started)

Click Linux/X11


Library dependencies


In the terminal type:

sudo apt-get install build-essential libgl1-mesa-dev


Android


Navigate to the Qt for Android installation instructions:

Click Developers page

Click Installation (in Get Started)

Click Android


Java


Let’s now install the Java JDK.

sudo apt-get install openjdk-7-jdk

Alternatively install oracle’s java7 JDK.

Ant


Now we install Ant

sudo apt-get install ant


Lets check the version number.

ant -version



Android Setup


In the browser show the ‘Android – Installing the Android SDK’

Using the File Manager, Open the ‘Home’ directory

Create new directory ‘develop/libs’

Move android files from ~/Downloads to ~/develop/libs


SDK

Extract SDK


Double click android_sdk_.tgz to extract all the files using Archive Manager.

Prerequisites


Navigate to the ‘Installing the Android SDK’ page :

  • Navigate to www.android.com

  • Click Android SDK

  • Click Installing SDK

  • Click ‘Stand-alone SDK Tools’

Click on ‘Show instructions for all Platforms’

Click ‘Troubleshooting Ubuntu’

Type the following:

sudo dpkg --add-architecture i386

sudo apt-get update

sudo apt-get install libncurses5:i386 libstdc++6:i386 zlib1g:i386

Note the ‘1’ is a one not an L.

Install SDK


Click the ‘Getting Started with Qt for Android’ tab

Scroll down to instructions on updating SDK.


SDK Update


In the terminal type:

cd ~/develop/libs/android-sdk-linux

./tools/android update sdk

If you get Glib errors you can ignore them.

Under Tools:

Select:


  • Android SDK Tools

  • Android SDK Platform Tools

  • Android SDK Build-tools (Latest)

By default all images are installed for the latest API. Just for now unselect all the components of the latest API. (e.g. for Android 5)

SDK API & Images Setup


Select the latest and earliest versions of the API you plan to support.

In this How-To we are interested in supporting Android 5.0 to Android 4.4.2.


Under Android 5.0.1 (API 21)

Select

Under Android 4.4.2 (API 19)

Select:


  • ARM EABI v7a System Image

  • Intel x86 Atom System Image

Click Install packages

Accept License

Click Install


Creating Virtual Android Devices


Let’s now create an ARM7 Device.

In the SDK Manager:

Click Tools-> Manage AVDs...

Click Create

Enter the following:

AVD Name: MyArm7

Device: 7” WSVGA

Target Android 5.0.1

CPU: ARM

Keyboard: set to present (ticked)

Skin: No skin

Use GPU: ticked

Click OK




Test the Device


Select MyArm7 in the list of virtual devices.

Click Start...

Click Launch

This can take up to 3 minutes to start the first time, and perhaps half that on subsequent start ups.

Close the Virtual Device.

Close the SDK Manager.


NDK


In browser locate instructions on NDK installation:

In the Android NDK tab, click Installing the NDK.

Type:

cd ~/develop/libs



chmod a+x android-ndk-r-linux-x86_64.bin

./android-ndk-r-linux-x86_64.bin


Qt Setup


Finally we are ready to setup Qt!

Navigate to the Developer’s page to read the Android installation instructions:



  • Click Developers page

  • Click Installation (in Get Started)

  • Click Android

Dependencies


In the Qt Getting started for Android tab, and show the library dependencies.

Type the following:

sudo apt-get install libgcc1:i386

Emulator


Type the following:

sudo apt-get install libsdl1.2debian:i386


Installing Qt


In the terminal type:

cd ~/Downloads

chmod a+x qt-opensource-linux-x64--online.run

./qt-opensource-linux-x64--online.run

Click Next.

Click Next to accept the installation directory.


Configuring components


To install a Qt kit component:

Expand the Qt version (e.g. 5.4)

Select the components:


  • gcc

  • Android x86

  • Android Arm 7

Note: If the latest version is a Release Candidate, is it highly recommended that you repeat the above selections to install the earlier stable release (e.g. 5.3).

Click Next

Accept the license agreement, and click Next.

Click Install (this may take up to 6 minutes to complete)

Untick the Readme.

Click Finish.

Note: You can use the Package Manager to change components later.

Qt Creator Setup


The Qt Creator should start automatically.

Click Tools->Options

Click Android (in the scroll panel)

In the Android Configurations tab:

Set the Android SDK Location by clicking Browse...

Browse to ~/develop/libs/android-sdk-linux, and click Open.

Set the Android NDK location by clicking Browse...

Browse to ~/develop/libs/android-ndk-

Click OK.

Note: the paths to Ant and Java should have been automatically found.


Running a Qt Example


Now we test an example application.

Click Examples

Click Qt Quick Demo – Clocks

In the Configure Project panel, we select only the stable release builds.:



  • Select Android for armeabi-v7a( e.g. GCC4.9, Qt 5.4)

  • Select Desktop Qt (e.g. 5.4)

Press Edit

Now we select the build type:

Select the Android Qt (e.g. 5.4) Kit (Release)

Press the Run button

Select the MyArm7 device. (Press refresh if this is not shown).

Click OK.

When the device has booted up, unlock the screen.

It may then take a few minutes to build and deploy to the device.


Final Note


This completes our How-To on installing Qt for Android on 64-bit Xubuntu.
Many developers prefer to run their Linux in a VM. Sadly, running the Android emulator in VirtualBox is fraught with difficulties, and although ARM7 devices may work in VMPlayer, it is very slow, and therefore practically unusable for any serious development work.
We recommend that you develop Android software on a Linux machine using an Android x86 Atom image, thereby allowing hardware and GPU acceleration to be turned on.

For more information, see: Use Android ICS Emulator for Ubuntu with KVM using Intel VT-x


Alternatively, use a real Android device (in developer mode) which is much faster.
Many Thanks,
Btoe

www.btoe.co.uk





Download 28.87 Kb.

Share with your friends:




The database is protected by copyright ©ininet.org 2024
send message

    Main page