Setup android-lighthouse (Qt for Android)

December 7th, 2010

I haven’t had much time to work on interesting development projects for a while.  This weekend I updated my phone to Android 2.1, and decided to try creating a simple application.  I wanted to leverage my Qt experience, so I decided to try the android-lighthouse project.

Development Setup

I want to run apps on my actual phone, so I setup my development VM locally using VMware Workstation (vSphere won’t connect to a local usb device). 

I choose Suse 11.3 as my development distro because the Android SDK needs new versions of glibc which Centos doesn’t have.

Once I had all the tools installed, Java configuration was a chore for some reason, I installed the Android SDK.  Important: I had to install an older version of the Android SDK to get android lighthouse to work.  I installed android-sdk_r06-linux_x86.tgz, then ran android and updated to SDK Platform Android 2.1-update1, API7. revision 2.

I can’t stress enough the importance of getting the Android SDK properly configured before starting any work with Qt Android Lighthouse!

android-lighthouse

I followed the instructions from android-lighthouse.  I configured my qmake.conf:

NDK_ROOT = /usr/local/qadk-r4

#NDK_ROOT = $(ANDROID_NDK_ROOT)

NDK_TOOLCHAIN = arm-eabi-4.4.0

ANDROID_PLATFORM = android-5 # 4 - android 1.6
                             # 5 - android 2.0 & 2.1
                             # 8 - android 2.2

I also updated my .basrc:

# Android SDK
export PATH=/usr/local/AndroidSDK/tools:/usr/local/AndroidSDK/platform-tools:$PATH

# Custom NDK
export NDK_ROOT=/usr/local/qadk-r4

# Qt for Android
export PATH=~/qt.lighthouse/bin:$PATH

Then I built Qt.  An hour later I was ready to test it out.

I edited the create_android_lighthouse_project.sh with my local paths.  Next I create a folder “qttest”, and built a test app.

That built with no errors, so I pushed up my Qt .so’s and ran into a problem.  The instructions for pushing the so’s were not actually pushing the so’s.  I discovered this when the test failed on the emulator due to a missing so file.  The Android ddms utility is quite helpful  for seeing what is happening on the emulator!

My next attempt resulted in an “out of space” error.  I fixed that by starting the emulator via: “emulator -avd my_avd -partition-size 512”.  After that I had plenty of space on my device.

The small sample ran, but was boring.  I copied the “examples\dialogs\tabdialog” to my test, built that, and here is the result:

qt-android-1

I shut down my emulator, and plugged in my phone (a Motorola cliq).  I restarted adb as root so it could talk to my device, and ran my test successfully there.

Conclusions

Getting this configured and running took much longer than I expected.  Getting a working development environment took me a couple of days!  This was due to several factors:

  1. My choice of the Linux distro.  Centos will not work, Ubuntu had strange issues with Slickedit 2009, and Suse always takes longer to configure then it should.
  2. Using the current Android SDK bit me in the ass.  Maybe it can be used without problems, but I couldn’t figure that out.
  3. Qt Build speed.  It takes 1-2 hours to build Qt before you can try a sample.  Also, I had errors due to libcloog, missing –lQtOpenGL, etc.  These were cleaned up by re-giting the source and building from scratch.
  4. Getting Sun Java 1.6 JDK configured under Suse seemed much harder than it needed to be.  The whole “update-alternatives” seems like a train wreck waiting to happen.  I’m sure if I did Java development I would use and like it, but I just wanted a single JDK and it bit me.

Once I had it built and configured, I was impressed.  At one level it’s just a library built for Arm using the NDK, at another level it’s a cross platform solution that lets me create native applications for Windows, Linux, Mac, and now Android.  That’s old school impressive. 

I had hoped that Silverlight would be this solution, but Microsoft managed to bungle that by dropping the ball on the cross platform support.  If the solution is Qt, that isn’t too bad at all.

Entry Filed under: Uncategorized

1 Comment Add your own

  • 1. Aries  |  January 13th, 2011 at 1:43 am

    That’s great, I’m just looking for Qt for android dev.
    Thanks.

Leave a Comment

Required

Required, hidden

Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Trackback this post  |  Subscribe to the comments via RSS Feed


Calendar

December 2010
M T W T F S S
« Nov   Jan »
 12345
6789101112
13141516171819
20212223242526
2728293031  

Most Recent Posts