Necessitas/InstallSDK: Difference between revisions

From KDE Community Wiki
mNo edit summary
 
(32 intermediate revisions by 11 users not shown)
Line 1: Line 1:
== Audience ==
== 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 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: [Compile Qt framework] instead.
If you want to tinker 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.
If you are unsure, then this is the correct page for you.


== Introduction ==
== 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.
Since 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.
The Qt Sdk for Android and the Android integration plugin is provided to you through a simple three-click install wizard, like the image of the official Qt Sdk. This will install in the folder of your choice everything you need to start writing Qt Application for Android. This installer is very lightweight and lets 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].
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.
Keep reading to install the Necessitas SDK using the online installer.
Some technical details
== 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 nativa code shared library (a .so object).
Android is a complex platform and it's based on Java (albeit it does not use a Java VM but Dalvik). Because of 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...
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...
Line 28: Line 26:
* You need a recent release of Ant tool (1.8+),
* 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),
* 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
* Since Necessitas requires the linkage of various dynamic 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.
* Due to limitations in early Android NDK (and platform specifications), android 2.3 is the *minimum requirement* to be able to run the debugger on your target device.


More on each specific platform later on.
More on each specific platform later on.


== Get the Necessitas SDK (all platforms) ==
== Get the Necessitas SDK (all platforms) ==




Go on the necessitas project home page, find and download the last stable binary version: [[https://sourceforge.net/projects/necessitas/files/]]. Grab the correct release for your development platform and wait for the download to complete.
Go on the necessitas project home page, find and download the last stable binary version: (get it from here: http://necessitas.kde.org/necessitas/necessitas_sdk_installer.php). 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.
The online installer 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!
Now go to the specific section for your platform and proceed with the installation!


Remember the folder where you save the downloaded binary.
Remember the folder where you save the downloaded binary.


== Installing on Linux ==
== Installing on Linux ==
Line 50: Line 46:
=== Prerequisites (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:
Any recent Linux distributions should work ok with Necessitas SDK. It has been tested and developed on Ubuntu Linux. Any release from 10.4 and later should be supported. 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 ''build-essential'' package (on Ubuntu based distros, others might vary) because you will need the usual build tools and development libraries.
* the OpenJDK package,
* the OpenJDK package, openjdk-6-jdk, on Ubuntu.
* 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!
* the ant package (minimum version 1.8). If your distro is a bit outdated, you most probably have the older ant 1.7 installed, please upgrade!
* users of 64-bit systems might need to install the ia32-libs-gtk (on debian, other distros may vary), as the installation program is linked against 32-bit libraries.
** In the case of running Debian wheezy, it appears necessary to add the right architecture prior to installing the ia32-libs-gtk: <source lang="bash" enclose="none">sudo dpkg --add-architecture i386; sudo apt-get update</source>


=== Installation (Linux) ===
=== Installation (Linux) ===
Line 65: Line 63:
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.
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.
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 want a system-wide install or /home/your_user/necessitas for a local install.


Remember your install location!
Remember your install location!
Line 71: Line 69:
=== Running (Linux) ===
=== Running (Linux) ===


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


  /your_necessitas_install_location/QtCreator/bin/necessitas
  /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].
If everything has been completed properly, you should be able to start using Necessitas. In some cases though, QtCreator might not be properly initialized; in that case, please refer to [http://community.kde.org/Necessitas/Qt4Creator#Setting_up_Qt_Creator Setting up Qt Creator].


Now, check [How to write Qt apps for Android] to be able to write your first application with Qt for Android!
Now, check [How to write Qt apps for Android] to be able to write your first application with Qt for Android!
Line 81: Line 79:
=== Common problems and issues (Linux) ===
=== Common problems and issues (Linux) ===


None reported so far.
The installation program is a 32-bit binary. When installing on a 64-bit system, you need to have 32-bit libraries available, or else you will get errors about libraries not found.
 
After enabling Debian multi-arch support, I needed to do "apt-get install libglib2.0-0:i386 libsm6:i386 libxrender1:i386 libfontconfig:i386" before the installer would run.


== Installing on Windows ==
== Installing on Windows ==
Line 105: Line 105:
On Windows, just make sure that all the paths are properly set. You must fill in the Java path yourself, pelase do not forget!
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 this image:
Refer to the following image:
windows paths
 
[[File:windows_paths.jpg|border]]


and double check all your paths.
and double check all your paths.
Line 113: Line 114:


Now, check [How to write Qt apps for Android] to be able to write your first application with Qt for Android!
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) ===
=== Common problems and issues (Windows) ===


Line 123: Line 125:
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!
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:   
1. you have the root folder of sh.exe in the Windows PATH.   
2. there is a space on your project path (example: "C:\QT Workspace" does not work but "C:\QT_Workspace" works).
'''android-ndk\toolchains\arm-linux-androideabi-4.4.3\prebuilt\windows\bin\arm-linux-androideabi-strip.exe:-1: error: C:PathToYourProjectandroidlibsarmeabi-v7aProjectName.so': No such file
'''-1: error: Can't copy gdbserver'''
This can be caused by having any version of sh.exe on your Windows system path, for example from Cygwin.  You can check this using the following command in a Windows console (cmd.exe):
  where sh.exe
Simply remove the other locations from your PATH environment variable and restart QTCreator


== Installing on MacOSX ==
== Installing on MacOSX ==
Line 138: Line 160:
The required ant package will be downloaded and installed autimatically.
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 user/necessitas (or similar). Please make sure there are no spaces or blanks in the path name!
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) ===
=== Running (MacOSX) ===
Line 146: Line 168:
On MaOSX, just make sure that all the paths are properly set. You must fill in the Java path yourself, pelase do not forget!
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 (sorry, missing screenshot):
Refer to this image:


and double check all your paths.
[[File:mac_qtcreator.jpg|800px]]
 
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].
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!
Now, check [How to write Qt apps for Android] to be able to write your first application with Qt for Android!

Latest revision as of 17:49, 3 November 2013

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 tinker 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

Since 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, like the image of the official Qt Sdk. This will install in the folder of your choice everything you need to start writing Qt Application for Android. This installer is very lightweight and lets 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 of 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 dynamic 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* to 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: http://necessitas.kde.org/necessitas/necessitas_sdk_installer.php). Grab the correct release for your development platform and wait for the download to complete.

The online installer 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 should work ok with Necessitas SDK. It has been tested and developed on Ubuntu Linux. Any release from 10.4 and later should be supported. Just make sure all the following basic requirements are installed:

  • the build-essential package (on Ubuntu based distros, others might vary) because you will need the usual build tools and development libraries.
  • the OpenJDK package, openjdk-6-jdk, on Ubuntu.
  • the ant package (minimum version 1.8). If your distro is a bit outdated, you most probably have the older ant 1.7 installed, please upgrade!
  • users of 64-bit systems might need to install the ia32-libs-gtk (on debian, other distros may vary), as the installation program is linked against 32-bit libraries.
    • In the case of running Debian wheezy, it appears necessary to add the right architecture prior to installing the ia32-libs-gtk: sudo dpkg --add-architecture i386; sudo apt-get update

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 want a system-wide install or /home/your_user/necessitas for a local install.

Remember your install location!

Running (Linux)

It's simple and GUIish! 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 though, QtCreator might not be properly initialized; in that case, please refer to Setting up Qt Creator.

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)

The installation program is a 32-bit binary. When installing on a 64-bit system, you need to have 32-bit libraries available, or else you will get errors about libraries not found.

After enabling Debian multi-arch support, I needed to do "apt-get install libglib2.0-0:i386 libsm6:i386 libxrender1:i386 libfontconfig:i386" before the installer would run.

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: 1. you have the root folder of sh.exe in the Windows PATH. 2. there is a space on your project path (example: "C:\QT Workspace" does not work but "C:\QT_Workspace" works).


android-ndk\toolchains\arm-linux-androideabi-4.4.3\prebuilt\windows\bin\arm-linux-androideabi-strip.exe:-1: error: C:PathToYourProjectandroidlibsarmeabi-v7aProjectName.so': No such file

-1: error: Can't copy gdbserver

This can be caused by having any version of sh.exe on your Windows system path, for example from Cygwin. You can check this using the following command in a Windows console (cmd.exe):

 where sh.exe

Simply remove the other locations from your PATH environment variable and restart QTCreator

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