Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1107117
  • 博文数量: 276
  • 博客积分: 8317
  • 博客等级: 少将
  • 技术积分: 2329
  • 用 户 组: 普通用户
  • 注册时间: 2006-09-12 08:17
个人简介

http://ads.buzzcity.net/adpage.php?partnerid=40096

文章分类

全部博文(276)

文章存档

2013年(1)

2012年(38)

2011年(102)

2010年(85)

2009年(45)

2008年(5)

分类: 嵌入式

2011-05-10 21:08:14

Requirements
  • download and install Official Android NDK
  • clone  repository
  • git clone git://gitorious.org/~taipan/qt/android-lighthouse.git
Prepare & compile Qt
  • Edit androidconfigbuild.sh and set the vars.
  • to configure and compile Qt use androidconfigbuild.sh script file
  • ./androidconfigbuild.sh
  • compile Qt !!
  • make -j X

where X is the number of CPU cores+1

  • if you compile Qt as share library you must copy qt libs to device/emulator
  • mkdir andlibs
    cp
    -a lib/*.so* andlibs/
    adb push andlibs /data/local/qt/lib
    rm -fr andlibs
Prepare & compile Qt applications and create Android packages

Before we start let's clarify what is an android application? Android applications are java apps packed into a package. In this package you can also embed one or more (shared) libs which can be loaded from java code and can interact with java using JNI. Currently you can't have a binary application in the package so, qt application, embedded in this bundle, are in fact shared libs.

For more informations about android application architecture, please consult Android Application Fundamentals page.

I see 3 scenarios to use Qt on Android:

Using Qt to write entire applications for Android
Using Qt to write entire applications for Android is very easy, you have to have a java application which will load the qt application and start it.

You don't have to write your own jni<=>java connections , all the magic is done from java by com.nokia.qt package, take a look toexamples/android/QtTest/src/com/nokia/qt, (I hope Nokia want sue me because I used this name ;-) ) and from c++ by the android graphics system plugin located to src/plugins/graphicssystems/android. For more informations you can read .

  1. You need to create a Java application. Java application will have only one class which extends QtActivity and in it's constructor to set the application to load (see android/QtTest/src/org/example/qt/QtMain.java). Yes you read it right, that all you need to do in java!!!
  1. Embed the resulted lib into the .apk package or put it to /data/local/lib (using adb push command). The loader will search for library first into /data/local/lib and then into package lib path.
Using Qt as a platform to write applications for Android

You can use the powerful QtCore, QtXml, QtSvg, QtSql, etc. to help you to write your own libs to help your java part. Here you will have to take care about java <=> jni integration. For example you can use Qt's stl like containers (QVector, QList, etc.).

Using Qt to write standalone applications (not bundled in a package) for Android

The last scenario to use Qt is to use it as a standalone applications, you need to make sure the CONFIG variable doesn't contain android value.

CONFIG -= android
阅读(490) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~