Necessitas/InstallSDK

From KDE Community Wiki

Audience

If you plan to port or develop an application for Android using the Qt framework, this is the page you are interested in.

If you want to thinker with the Qt framework for Android or improve the Necessitas project, you should follow this page: Necessitas/CompileQtFramework instead.

If you are unsure, then this is the correct page for you.

Introduction

The Necessitas SDK for Android is developed under GNU/Linux, the preferred platform to use the Necessitas SDK is GNU/Linux. Anyway, thanks to the great contribution of Ray Donnelly the users of Necessitas SDK can also enjoy both a Windows and MaxOSX port. These port, however, do require a little bit of extra effort to work and might not be as easy as the Linux port. However, all the ports are usually updated at the same time.

The Qt Sdk for Android and the Android integration plugin is provided to you through a simple three-click install wizard, as the image of the official Qt Sdk, this will install in a folder of your choice anything you needs to start writing Qt Application for Android. This installer is very lightewight and let's you select only the components you need. As a drawback, an active internet connection is required at all times during installation.

At the moment there is no offline installation tool. If your developing workstation does not have an active internet connection, your best chance could be to pull all the git repositories and build everything from scratches yourself. Check [Compile Qt framework] and [Compile QtCreator].

Keep reading to install the Necessitas SDK using the online installer.

Some technical details

Android is a complex platform and it's based on Java (albeit it does not use a Java VM but Dalvik). Because if this, you cannot simply create an executable and run it on an Android device. You must create a Java application which links and manages a native code shared library (a .so object).

Necessitas does all this for you, automagically, trying to hide all the nuisances of the process from you, but you need to be aware of a few things anyway...

  • You need a Java JDK (the JRE is not enough),
  • You need a recent release of Ant tool (1.8+),
  • Your PC must meet the Android SDK and Android NDK hardware/software requirements (check http://developer.android.com/sdk/index.html),
  • Since Necessitas requires the linkage of various dinamic libraries on your Android device, the minimum target requirement is Android 1.6
  • Due to limitations in early Android NDK (and platform specifications), android 2.3 is the éminimum requirement* fo be able to run the debugger on your target device.

More on each specific platform later on.

Get the Necessitas SDK (all platforms)

Go on the necessitas project home page, find and download the last stable binary version: (get it from here: https://sourceforge.net/projects/necessitas/files/). Grab the correct release for your development platform and wait for the download to complete.

The online installed will automatically pull for you the Android SDK and the Android NDK, so you don't need to download them separately.

Now go to the specific section for your platform and proceed with the installation!

Remember the folder where you save the downloaded binary.

Installing on Linux

Prerequisites (Linux)

Any recent Linux distributions shuold work ok with Necessitas SDK. It has been tested and developed on Ubuntu Linux, any release from 10.4 should be supporter, just make sure all the following basic requirements are installed:

  • the build-essential package (Ubuntu based distro, other might vary), because you will need the usual build tools and development libraries,
  • the OpenJDK package,
  • the ant (minimum version 1.8) package is installed. If your distro is a bi outdated, you most probably have the older ant 1.7 installed, please upgrade now!
  • user of 64 bits systems might need to install the ia32-libs-gtk (on debian), as the installation program is linked against 32 bits libraries

Installation (Linux)

Open a terminal, go to the download folder, then set the executable bits and run the installer:

chmod +x necessitas-x.y-online-sdk-installer-linux
./necessitas-x.y-online-sdk-installer-linux

A nice GUI popup will appear, just follow the onscreen instructions. Please make sure you select the Android SDK and Android NDK, because the installer will downlaod the specific versions required by Necessitas. You can also select the Android platforms you want to support. Make sure to select at least one, maybe more.

You should double check the installation folder and make sure it's something sensible. The best choice would be /opt/necessitas (or similar) if you can install system-wide or /home/you_user/necessitas if you must use your local folder.

Remember your install location!

Running (Linux)

It's simple and guish! From a terminal, run:

/your_necessitas_install_location/QtCreator/bin/necessitas

If everything has been completed properly, you should be able to start using Necessitas. In some cases tough the QtCreator could not be properly initialized, that case please refer to Setup QtCreator.

Now, check [How to write Qt apps for Android] to be able to write your first application with Qt for Android!

Common problems and issues (Linux)

None reported so far.

Installing on Windows

Prerequisites (Windows)

Necessitas SDK works on Windows XP, Vista and 7, just make sure all the following basic requirements are installed:

  • Windows XP SP3 minimum,
  • Any Java JDK (1.6 minimum, Oracle Java is the only one tested). Note that JDK is mandatory and JRE is not sufficient.

All the other requirements will be pulled by NEcessitas SDK during installation.

Installation (Windows)

Double click on the downloaded executable, a nice GUI popup will appear, just follow the onscreen instructions. Please make sure you select the Android SDK and Android NDK, because the installer will downlaod the specific versions required by Necessitas. You can also select the Android platforms you want to support. Make sure to select at least one, maybe more.

The required ant and Cygwin packages will be downloaded and installed autimatically.

You should double check the installation folder and make sure it's something sensible. The best choice would be c:\necessitas (or similar). Please make sure there are no spaces or blanks in the path name!

Running (Windows)

You should find the Necessitas SDK links in the start menu. Just run the QtCreator!

On Windows, just make sure that all the paths are properly set. You must fill in the Java path yourself, pelase do not forget!

Refer to the following image:

and double check all your paths.

If everything has been completed properly, you should be able to start using Necessitas. In some cases tough the QtCreator could not be properly initialized, that case please refer to [Setup QtCreator].

Now, check [How to write Qt apps for Android] to be able to write your first application with Qt for Android!

Common problems and issues (Windows)

I cannot build! Not even compile!

There can be many reasons for this! One of the trickiest, Necesistas does not like spaces of blanks in the paths! Specially in the Necessitas isntallation folder and you project folder! Make sure there are no blanks or spaces! Also, make sure the Android NDK path is correct. The right one should be under your NEcessitas installation folder.

Missing tools.jar

This error usually happens during the deploy/run/debug phase. Sometimes the Java JDK messes things up, just search your hard drive for a files called tools.jar and copy it under the lib folder inside your Java JDK installation. If you cannot find the file anywhere, install the Java JRE where you should find it. Sometimes, this error is due to a Java mismatch. If you have more than one Java isntallation (for example, one JDK and one JRE, or more JDK releases) make sure each one has the tools-jar file under the lib folder!

build.xml does not exist

If you have issues when trying to build a project, make sure that the java.exe executable is in your path and double check that's the one from the Java JDK you have installed!

""ma-make: *** [install_target] Error 1""

This error can appear in two cases: - you have the root folder of sh.exe in the Windows PATH - there is a space on your project path (example: "C:\QT Workspace" does not work but "C:\QT_Workspace" works)

Installing on MacOSX

Prerequisites (MacOSX)

Necessitas SDK works on MacOSX, just make sure these requirements are fullfilled:

  • MacOSX 10.XX minimum.

All the other requirements will be pulled by Necessitas SDK during installation. Java is already installed on MacOSX and does not need to be added separately.

Installation (MacOSX)

Double click on the downloaded executable, a nice GUI popup will appear, just follow the onscreen instructions. Please make sure you select the Android SDK and Android NDK, because the installer will downlaod the specific versions required by Necessitas. You can also select the Android platforms you want to support. Make sure to select at least one, maybe more.

The required ant package will be downloaded and installed autimatically.

You should double check the installation folder and make sure it's something sensible. The best choice would be /Users/<username>/necessitas (or similar). Please make sure there are no spaces or blanks in the path name!

Running (MacOSX)

You should find the Necessitas SDK links in the Finder/Applications folder. Just run the QtCreator!

On MaOSX, just make sure that all the paths are properly set. You must fill in the Java path yourself, pelase do not forget!

Refer to this image:

and double check all your paths!

If everything has been completed properly, you should be able to start using Necessitas.

Now, check [How to write Qt apps for Android] to be able to write your first application with Qt for Android!

Common problems and issues (MacOSX)

TBD