here´s a tutorial which may help you to get a 'hello world'.
https://docs.google.com/document/d/1kibSyo9gxaB2pQ7Enm1noSV7MRsXSNy2PDq2ctTr
I5Q/edit?hl=en&authkey=CJ79k_EE
kindest regards Steve
-----Ursprüngliche Nachricht-----
Von: andro...@googlegroups.com [mailto:andro...@googlegroups.com] Im
Auftrag von Ashwin Kumar
Gesendet: Freitag, 28. Januar 2011 03:31
An: android-qt
Cc: ashwink...@gmail.com
Betreff: Help me get started with android-lighthouse.
I want to make something clear. I (and when I say I, I mean only my
person not this project) can't offer support for other platforms than
GNU/Linux this doesn't mean I'll not accept patches or other people
work for other platforms.
BogDan.
2011/1/28 İsmail Dönmez <ism...@namtrac.org>:
I wrote a french tutorial about getting Qt on Android version correctly
set up, with some clarifications:
http://blog.freelan.org/2010/11/27/developper-avec-qt-pour-android/
And here you have an not-up-to-date version of the article in english,
that I didn't published because it wasn't enough well written:
Developping with Qt on Android
-------------------------------
Developing Qt Applications, that is to say using the Qt Framework
in Android apps, or launching C++ Qt Native apps from a simple Java
Android Main Class is possible thanks to the <a
href="http://code.google.com/p/android-lighthouse/"
target="_blank">android-lighthouse</a> project, and <a
href="http://taipan.blip.tv/" target="_blank">works well (click to see
the videos</a>!
Lighthouse is a project that the Qt Framework team has launched
before the version 4.7 to make Qt portable to any platform easily.
Indeed this require only small part of the Qt code to be extended with
platform-specific calls to make all the Qt libraries run on the targeted
platform. Thanks to android-lighthouse we can also see that porting the
libraries is really fast. Only some months were needed to get fully (or
pretty fully) functionial version: even QML based UI are running! This
was possible through the implication of the project initiator: BogDan
Vatra, which demonstrated here that Qt is portable everywhere: Code
less, do more, deploy everywhere!
This makes porting Qt apps really easily on android, so writing an
app with the Qt Libraries now means that you can recompile it for :
Symbian, Windows, Mac, Linux & Android! :) It's just perfect to make a
reusable code base in your company. You can also develop too library
code with Qt and bind it with JNI to help your existing Java Android
application.
<b>Supported Platforms</b>
--------------------------
When the Qt android-lighthouse project was created there were 1.5
supported devices with statically linked Qt. The current branch support
now only dynamically linked Qt (which reduces memory usage of the
applications - James Noble & Charles Weir 2001 -, because they share the
same Qt libraries) and supports the current android platform in use on
the Market: android 1.6, 2.0, 2.1 & 2.2. You can try with the android
emulator because it is working like real devices, this is just fine :).
<b>Some Limitations</b>
-----------------------
There is currently (25/11/2010) <a
href="http://code.google.com/p/android-lighthouse/issues/list"
target="_blank">some limitations</a>, for example rendering is done only
with Qt software rendering, although the Open GL rendering support is
being actively developed for android Open GL enabled devices. It's
certainly just a question of days to see the Open GL working with Qt
applications, because until now the port has been really fast, and the
activity on the git repository is always active.
Another limitation which will get fixed soon is that you can't use
QtMultimedia to play sound, there are other solutions to do it though.
Although waiting the port of Qt Multimedia should be a good solution
because it will be done soon, and according to the initiator of the Qt
android-lighthouse project this should be the <a
href="http://code.google.com/p/android-lighthouse/issues/detail?id=5"
target="_blank">easiest fix he has to do</a>.
<b>Some clarifications</b>
--------------------------
You don't need to be root or to get root shell access on your
device to deploy Qt Applications this means that you could send the
application on Google Market. Although currently I would not do it, I
would wait that it gets more tested and used (what a growing community
is currently doing: http://groups.google.com/group/android-qt/).
<b>Prepare your development environment</b>
------------------------------------------
I wrote this following instructions according to the page
http://code.google.com/p/android-lighthouse/wiki/Compile and to my own
experience on Linux. If you are on windows you should consider the
following issue: <a
href="http://code.google.com/p/android-lighthouse/issues/detail?id=11"
target="_blank">Configure does not work with Cygwin on winxp</a> and
apply the patch for cygwin given in a reply. Finally if you are on a Mac
OS X just forget it for the moment (or find a solution :p): <a
href="http://code.google.com/p/android-lighthouse/issues/detail?id=18"
target="_blank">broken build on mac osx - x86</a>.
Linux seems to be the best platform to develop with Qt for android
currently, so if you aren't running this platform, I advice that you try
with a <a href="http://www.virtualbox.org/wiki/Downloads"
target="_blank">Virtual Machine</a>, at least it's the one that I can
insure it works. :)
Currently some things said on the page given are not true to
compile qt applications for andro�d, so I will guide you into the right
path to make your Qt application work on Android, like Francisco Dalla
Rosa Soares showed me yesterday on the android-lighthouse mailing list. :)
<b>++ Download</b>
First of all you have to download and untar in some folder the <a
href="http://code.google.com/p/android-lighthouse/wiki/QADK"
target="_blank">QADK</a>, the QADK is an unofficial Native Development
Kit for android, based on the official one but with some unsupported
libraries:
wget
http://android-lighthouse.googlecode.com/files/qadk-r4-1.tar.bz2
tar xf qadk-r4-1.tar.bz2 .
Then you will have to clone the android-lighthouse git repository
which consists of a clone of the qt lighthouse project which is
officially provided by Nokia:
git clone git://gitorious.org/~taipan/qt/android-lighthouse.git
<b>++ Configure & Build</b>
You will have to compile Qt for the targeted platform, to do so you
first have to set the ANDROID_PLATFORM and the NDK_ROOT to point the
folder where you untared the QADK.
mkspecs/android-g++/qmake.conf:12 ->
NDK_ROOT = /path/to/qadk-r4
mkspecs/android-g++/qmake.conf:18 ->
ANDROID_PLATFORM = android-5
The last one is to target the android 2.0 & 2.1 platform, which
worked without problems for me. Use <i>android-4</i> to target 1.6
devices and <i>android-8</i> to target 2.2 devices.
Now you have to run the slooow configure part (don't hesitate to
take a pause with your girlfriend during this):
./androidconfig.sh
And then just compile:
make -j3
Change 3 by the number of processor core you have plus one, this
will enable parallel compilation with the same number of processes.
There is a dependency for qt which is not included in the project,
it's libcloog-ppl-dev, just run
sudo apt-get install libcloog-ppl-dev
<b>++ Install Qt on Device</b>
Now a good thing will be to have qt on the device (or the
emulator), to do so simply makes what the google code wiki page advices:
mkdir andlibs
cp -a lib/*.so* andlibs/
adb push andlibs /data/local/qt/lib
<b>+++ Connect your device</b>
Here if you get <i>adb: command not found</i>, it's because you are
new to android development (like me). So simply download the last
android sdk, you can find detailed instructions <a
href="http://blog.freelan.org/2010/11/20/installer-lenvironnement-de-developpement-pour-android/"
target="_blank">here</a> and the sdk <a
href="http://developer.android.com/sdk/index.html" target="_blank">here</a>.
Although at this step of the article you simply need to download
the SDK, set the PATH variable and run:
tools/android update sdk
Then if you want to try on your real device you will have to set
the connection with it, to do that I invite you to follow the small part
described <a
href="http://developer.android.com/guide/developing/device.html#setting-up"
target="_blank">here</a>.
I am on linux so I simply made the following configuration for my
LGGT540 Android 2.1 Phone. On my Ubuntu 10.10 I provided the following
information in the /etc/udev/rules.d/51-android.rules file:
SUBSYSTEM=="usb", SYSFS{idVendor}=="1004", MODE="0666"
SUBSYSTEM=="usb_device", SYSFS{idVendor}=="1004", MODE="0666"
Where 1004 comes from a provided list of Vendors Id for android
devices:
http://developer.android.com/guide/developing/device.html#VendorIds.
Pickup the one for your device. :)
On windows you simply have to install adb drivers, and on Mac OS X
it just works, although remember android-lighthouse for Mac OX seem not
to be working.
To list the existing android devices you can run <i> adb devices</i>.
<b>++ Create your first Qt Application for android</b>
We will not write our own code (yes I know it's not fun), because
there is alot of Hello World-like in the Qt Sdk. So we will choose a
simple one, to explain compilation configuration and how to create an
android java project to launch the application.
Indeed it isn't possible currently to compile directly the Qt
Application as a native executable. It is necessary to compile it into a
dynamic library, which will get loaded with the help of a small java
launcher. Which will be based on the base classes provided by
android-lighthouse. These ones are present in the
com.nokia.qt.QtActivity package.
Now cd to <i>/android-lighthouse/demos/mainwindow/</i>, here you
can open the mainwindow.pro file, which should begin with the following:
TEMPLATE = lib
CONFIG += dll
HEADERS += colorswatch.h mainwindow.h toolbar.h
SOURCES += colorswatch.cpp mainwindow.cpp toolbar.cpp main.cpp
It is really important to compile the application as a library, so
for your next application dont forget to use the two first line.
Personally I prefer CMake, but I've not prepared it for android for the
moment, but it should just consists in an edit of the qt_wrap_cpp
method, to let it use our specialized qmake.
Indeed to compile the application, please use
<i>android-lighthouse/bin/qmake</i> to generate the moc file, and not
the one you have in the PATH.
/path/to/android-lighthouse/bin/qmake
make -j3
And that's all, you don't have to edit your Qt Application code.
The result of the commands you've ran should be an so (shared object)
file with differents symbolic links to enable the libtool compatibility
informations.
Simply push the one without compatibility informations on your
android device: <i>adb push libmainwindow.so /data/local/qt/lib</i>.
That done your application is on the phone, but there isn't any launcher
for it.
<b>++ Create the android project</b>
So we will create a launcher in Java, based on the launcher
provided by the android-lighthouse project, which cares alone of the JNI
bindings. :D
First <a
href="http://blog.freelan.org/2010/11/22/developper-pour-android-sans-utiliser-eclipse/"
target="_blank">create a project</a> in a subdir (javaLoader for example):
android create project --target 2.1 \
--name mainwindow \
--path ./ \
--activity mainwindow \
--package com.yourcompany.mainwindow
Create a QtMain.java (vim alone or with eclim is a cool tool for that):
package org.yourcompany.mainwindow;
import com.nokia.qt.QtActivity;
public class QtMain extends QtActivity
{
public QtMain()
{
//setLibraries(libraries); This could be useful for you
if you need to load some other libraries with your application.
setApplication("mainwindow");
}
}
And then just type:
ant debug
cd bin
adb install mainwindow-debug.apk
Your application is installed, and can easily be launched on your
device through:
adb shell am start -a android.intent.action.MAIN -n
com.yourcompany.mainwindow/.mainwindow
For the moment I didn't manage to debug the application on the
device, but console output is being redirected so you can view the
qDebug outputs. I think debugging on the device should be possible with
qadk-r4/ndk-gdb, but currently I don't know how. :) I will post as soon
as I get that. ;)
Thank you for reading,
daminetreg
Ashwin Kumar wrote:
> No issues... I love Linux a lot. Will try my luck and effort there.
>
> But do not mind, I will be back to you if I get some questions/doubts.
> ;-) ;-)
>
> I really thank you for the response.
>
> On Fri, Jan 28, 2011 at 1:08 PM, BogDan <taipan...@gmail.com
> <mailto:taipan...@gmail.com>> wrote:
>
> Hi Ashwin,
>
> Sadly windows is not (yet) supported (check
> http://code.google.com/p/android-lighthouse/issues/detail?id=11 ).
>
> Please try to use a Linux box instead.
>
> BogDan.
>
> On Jan 28, 4:31 am, Ashwin Kumar <ashwinkumar...@gmail.com
> <mailto:ashwinkumar...@gmail.com>> wrote:
> > How to get started with Android-Lighthouse on Windows 7? The wiki is
> > not strong enough for me to get started. Pls help. :-)
> >
> > Awaiting a response. Just with a 'hello world' example.
> >
> > ashwinkumar...@gmail.com <mailto:ashwinkumar...@gmail.com> is my id.
I wrote a french tutorial
Hi Ashwin,
I wrote a french tutorial about getting Qt on Android version correctly set up, with some clarifications: http://blog.freelan.org/2010/11/27/developper-avec-qt-pour-android/
And here you have an not-up-to-date version of the article in english, that I didn't published because it wasn't enough well written:
Developping with Qt on Android
-------------------------------
Developing Qt Applications, that is to say using the Qt Framework in Android apps, or launching C++ Qt Native apps from a simple Java Android Main Class is possible thanks to the <a href="http://code.google.com/p/android-lighthouse/" target="_blank">android-lighthouse</a> project, and <a href="http://taipan.blip.tv/" target="_blank">works well (click to see the videos</a>!
Lighthouse is a project that the Qt Framework team has launched before the version 4.7 to make Qt portable to any platform easily. Indeed this require only small part of the Qt code to be extended with platform-specific calls to make all the Qt libraries run on the targeted platform. Thanks to android-lighthouse we can also see that porting the libraries is really fast. Only some months were needed to get fully (or pretty fully) functionial version: even QML based UI are running! This was possible through the implication of the project initiator: BogDan Vatra, which demonstrated here that Qt is portable everywhere: Code less, do more, deploy everywhere!
This makes porting Qt apps really easily on android, so writing an app with the Qt Libraries now means that you can recompile it for : Symbian, Windows, Mac, Linux & Android! :) It's just perfect to make a reusable code base in your company. You can also develop too library code with Qt and bind it with JNI to help your existing Java Android application.
<b>Supported Platforms</b>
--------------------------
When the Qt android-lighthouse project was created there were 1.5 supported devices with statically linked Qt. The current branch support now only dynamically linked Qt (which reduces memory usage of the applications - James Noble & Charles Weir 2001 -, because they share the same Qt libraries) and supports the current android platform in use on the Market: android 1.6, 2.0, 2.1 & 2.2. You can try with the android emulator because it is working like real devices, this is just fine :).
<b>Some Limitations</b>
-----------------------
There is currently (25/11/2010) <a href="http://code.google.com/p/android-lighthouse/issues/list" target="_blank">some limitations</a>, for example rendering is done only with Qt software rendering, although the Open GL rendering support is being actively developed for android Open GL enabled devices. It's certainly just a question of days to see the Open GL working with Qt applications, because until now the port has been really fast, and the activity on the git repository is always active.
Another limitation which will get fixed soon is that you can't use QtMultimedia to play sound, there are other solutions to do it though. Although waiting the port of Qt Multimedia should be a good solution because it will be done soon, and according to the initiator of the Qt android-lighthouse project this should be the <a href="http://code.google.com/p/android-lighthouse/issues/detail?id=5" target="_blank">easiest fix he has to do</a>.
<b>Some clarifications</b>
--------------------------
You don't need to be root or to get root shell access on your device to deploy Qt Applications this means that you could send the application on Google Market. Although currently I would not do it, I would wait that it gets more tested and used (what a growing community is currently doing: http://groups.google.com/group/android-qt/).
<b>Prepare your development environment</b>
------------------------------------------
I wrote this following instructions according to the page http://code.google.com/p/android-lighthouse/wiki/Compile and to my own experience on Linux. If you are on windows you should consider the following issue: <a href="http://code.google.com/p/android-lighthouse/issues/detail?id=11" target="_blank">Configure does not work with Cygwin on winxp</a> and apply the patch for cygwin given in a reply. Finally if you are on a Mac OS X just forget it for the moment (or find a solution :p): <a href="http://code.google.com/p/android-lighthouse/issues/detail?id=18" target="_blank">broken build on mac osx - x86</a>.
Linux seems to be the best platform to develop with Qt for android currently, so if you aren't running this platform, I advice that you try with a <a href="http://www.virtualbox.org/wiki/Downloads" target="_blank">Virtual Machine</a>, at least it's the one that I can insure it works. :)
Currently some things said on the page given are not true to compile qt applications for androïd, so I will guide you into the right path to make your Qt application work on Android, like Francisco Dalla Rosa Soares showed me yesterday on the android-lighthouse mailing list. :)
Ashwin Kumar wrote:
> Dear Damien,
>
> Firstly, "
>
> I wrote a french tutorial
>
> Awesome job.
Thanks. :)
>
> Secondly, It helped me a lot. Google translation just did that for me.
> Weekend I will try to get lighthouse working in my PC.
I hope it will work, just email here if it doesn't, I'll keep my eyes on
the mails to be able to help you if needed.
>
> Would you mind if I can make this post more clear for a start-up
> user?, in English. :-)
> When I do it, I will send you a draft. You may post it on your blog. :-)
>
No problem, if you help me to make it up to date it's really nice. :-) I
would be really happy to work with you. Like said BogDan (below) we
could post it on the wiki of the project, it's better than on any blog.
BogDan wrote:
> Hi,
>
> Great job.
>
It's thanks to you and to Francisco Dalla Rosa Soares which is on this
mailing list. :) So I want to thank you a lot. :)
> If someone wants to write and update this tutorial directly on
> android-lighthouse wiki page, please contact me, I'll be very happy to
> give you access to wiki pages.
>
Like said above I would be happy to do that with Ashwin on the
long-term: taking it always up to date.
> BTW is a little outdated :), e.g. now you don't need to add "TEMPLATE
> = lib" and "CONFIG += dll" to your pro files. Please check Stefan's
> tutorial.
>
Yes I didn't got the time until now to come back on my work with
android. I'm interested in this tutorial, where can I find it?
And "merci beaucoup" for the information.
Kindest regards,
--
daminetreg
>> Symbian, Windows, Mac, Linux& Android! :) It's just perfect to make a
>> reusable code base in your company. You can also develop too library
>> code with Qt and bind it with JNI to help your existing Java Android
>> application.
>>
>> <b>Supported Platforms</b>
>> --------------------------
>> When the Qt android-lighthouse project was created there were 1.5
>> supported devices with statically linked Qt. The current branch support
>> now only dynamically linked Qt (which reduces memory usage of the
>> applications - James Noble& Charles Weir 2001 -, because they share the
>> same Qt libraries) and supports the current android platform in use on
>> the Market: android 1.6, 2.0, 2.1& 2.2. You can try with the android
>> compile qt applications for andro�d, so I will guide you into the right
>> path to make your Qt application work on Android, like Francisco Dalla
>> Rosa Soares showed me yesterday on the android-lighthouse mailing list. :)
>>
>> <b>++ Download</b>
>>
>> First of all you have to download and untar in some folder the<a
>> href="http://code.google.com/p/android-lighthouse/wiki/QADK"
>> target="_blank">QADK</a>, the QADK is an unofficial Native Development
>> Kit for android, based on the official one but with some unsupported
>> libraries:
>> wgethttp://android-lighthouse.googlecode.com/files/qadk-r4-1.tar.bz2
>> tar xf qadk-r4-1.tar.bz2 .
>>
>> Then you will have to clone the android-lighthouse git repository
>> which consists of a clone of the qt lighthouse project which is
>> officially provided by Nokia:
>> git clone git://gitorious.org/~taipan/qt/android-lighthouse.git
>>
>> <b>++ Configure& Build</b>
>>
>> You will have to compile Qt for the targeted platform, to do so you
>> first have to set the ANDROID_PLATFORM and the NDK_ROOT to point the
>> folder where you untared the QADK.
>>
>> mkspecs/android-g++/qmake.conf:12 ->
>> NDK_ROOT = /path/to/qadk-r4
>>
>> mkspecs/android-g++/qmake.conf:18 ->
>> ANDROID_PLATFORM = android-5
>>
>> The last one is to target the android 2.0& 2.1 platform, which
>> read more �
>>