Qt for Android 配置详细 (linux下的)

来源:互联网 发布:逆战淘宝代练1元一把 编辑:程序博客网 时间:2024/06/06 00:12

Qt for Android配置(Ubuntu11.04

一.环境搭建

 

1. Java 下载安装

       ->jdk-6u25-linux-i586.bin

       url:http://www.oracle.com/technetwork/java/javase/downloads/jdk-6u25-download-346242.html

       ->  1jdk-1_5_0_06-linux-i586.bin下载到/usr/soft,赋予可执行权限:chmod 755 jdk-1_5_0_06-linux-i586.bin

              2、执行:./jdk-6u25-linux-i586.bin    空格键翻页,到最后输入yes

              3、配置环境变量:在/etc/profile 中加入:

                     export  PATH=/usr/soft/jdk*.*/bin:$PATH

                     exportJAVA_HOME=/usr/soft/jdk*.*.*

              4、运行:source /etc/profile  使配置文件生效

              5、运行:java -version,显示jdk版本,jdk安装成功

       ->linux操作系统可能默认会安装有openjdk

              需要将自己安装的Java设置为默认的:

                     sudoupdate-alternatives --install /usr/bin/java java /usr/local/jdk1.6.0_26/bin/java1160

 

2. git GIT 是用于 Linux 开发的版本控制工具

      

-> unbutu 11.04 安装:

           sudo apt-get install git git-core

 

3. Android SDK

       ->http://developer.android.com/sdk/index.html

       ->解压下载的SDK文件 

              例如:/usr/local/bin/android-sdk-linux_x86-1.5_r2

       ->修改/etc/profile 文件

              ->export PATH=${PATH}/tools 

                     例如:export PATH=${PATH}/

                            android-sdk-linux_x86-1.5_r2/tools

              ->save

       ->restart

       ->输入: sudoandroid

       ->通过弹出界面配置SDK(此时的SDK并未安装完成,需要通过网络完成全部安装)。

              ->Settings 处勾选 force https://......

              ->AvailablePackages  勾选要安装的包

              ->Install Selectted 进行安装

       ->android avd配置信息的生成

              ->android avd的创建格式为:androidcreate avd -n your-avd-name -t your-targets

              ->其中: -n的参数为我们要创建的avd的名字;

                                   -t的参数为Available Android     targetsid,

                     我们可以使用命令:android list查寻其具体信息。

                            ->$android list

                                   AvailableAndroid targets:

                                   id:1

                                           Name: Android 1.1

                                           Type: Platform

                                           API level: 2

                                           Skins: HVGA-P, HVGA (default), QVGA-P, HVGA-L,QVGA-L

                                   id:2

                                           Name: Android 1.5

                                           Type: Platform

                                           API level: 3

                                           Skins: HVGA-P, HVGA (default), QVGA-P, HVGA-L,QVGA-L

                                   id:3

                                   .....................

                            ->创建avd:$android create avd -n android1.5 -t 2

 

                                   Android1.5 is a basic Android platform.

                                   Doyou wish to create a custom hardware profile [no]yes

 

                                   Deviceram size: The amount of physical RAM on the device, in megabytes.

                                   hw.ramSize[96]:128

 

                                   Touch-screensupport: Whether there is a touch screen or not on the device.

                                   hw.touchScreen[yes]:yes

 

                                   Track-ballsupport: Whether there is a trackball on the device.

                                   hw.trackBall[yes]:yes

 

                                   Keyboardsupport: Whether the device has a QWERTY keyboard.

                                   hw.keyboard[yes]:yes

 

                                   DPadsupport: Whether the device has DPad keys

                                   hw.dPad[yes]:yes

 

                                   GSMmodem support: Whether there is a GSM modem in the device.

                                   hw.gsmModem[yes]:yes

 

                                   Camerasupport: Whether the device has a camera.

                                   hw.camera[no]:

 

                                   Camerasupport: Whether the device has a camera.

                                   hw.camera[no]:yes

 

                                   Maximumhorizontal camera pixels

                                   hw.camera.maxHorizontalPixels[640]:854

 

                                   Maximumvertical camera pixels

                                   hw.camera.maxVerticalPixels[480]:480

 

                                   GPSsupport: Whether there is a GPS in the device.

                                   hw.gps[yes]:yes

 

                                   Battery support: Whether the device can run on a battery.

                                   hw.battery[yes]:yes

 

                                   Accelerometer:Whether there is an accelerometer in the device.

                                   hw.accelerometer[yes]:yes

 

                                   Audiorecording support: Whether the device can record audio

                                   hw.audioInput[yes]:yes

 

                                   Audioplayback support: Whether the device can play audio

                                   hw.audioOutput[yes]:yes

 

                                   SDCard support: Whether the device supports insertion/removal of virtual SDCards.

                                   hw.sdCard [yes]:yes

 

                                   Cachepartition support: Whether we use a /cache partition on the device.

                                   disk.cachePartition[yes]:yes

 

                                   Cachepartition size

                                   disk.cachePartition.size[66MB]:100MB

 

                                   CreatedAVD ''android-sdk-15'' based on Android 1.5

                                  

                            ->启动模拟器界面: $emulator @android-sdk-15-show-kernel

                           

       ->配置eclipse,使之支持android sdk(安装ADT插件):

              EclipseHelp->SoftwareUpdates->Available Software(根据提示进行相应操作)

 

4. Android NDK

       ->http://developer.android.com/sdk/ndk/index.html

       ->解压NDK包到指定目录

              ->配置PATH

              ->修改/etc/profile 文件

                     ->  NDKROOT=/usr/local/bin/android-ndk-r5c (用户根据自己的实际安装配置)

                            PATH=$PATH:$NDKROOT

                     ->save

              ->restart

       ->测试环境变量:

              ->cd /usr/local/bin/android-ndk-r5c/samples/hello-jni

              ->ndk-build

              ->将看到系统会编译出libhello-jni.so

 

5. 安装necessitas

http://sourceforge.net/projects/necessitas/files/

(包括Qt的库,Qt Createrfor Android, 同时可以选择安装NDK SDK(但是由于网速问题建议不要选择可以自己安装)):

       ->下载necessitas-0.2-online-sdk-installer-linux

       ->使用 chmod 添加可执行权限

       ->安装过程需要网络环境

 

6. Ministro

需要在android上安装Ministro service

url: http://sourceforge.net/projects/ministro.necessitas.p/files/

 

7. 模拟器启动命令

在命令行输入: emulator -help,即可显示emulator支持的所有命令。

Android Emulator usage:

    emulator [options] [-qemu args]
 

options:
    -sysdir

在目录
中搜索system.img
    -system               
读取system.img文件   
    -datadir
写入用户数据到目录

    -kernel               
使用指定内核kernel-qemu文件 
    -ramdisk              
指定ram 镜像文件ramdisk.img
    -image                 obsolete, use -system instead
    -init-data             initial data image (default /userdata.img
    -initdata              same as '-init-data '
    -data                  data image
                                  (default /userdata-qemu.i
mg
    -partition-size        
 分区大小MBs
    -cache                 cache.img
   -no-cache                     
禁止缓存 
   -nocache                      
禁止缓存 
    -sdcard                sdcard.img
   -wipe-data                    reset the use data image (copy it from initda
ta)
    -avd                   
使用指定AVD设备 
    -skindir
/skins
)
    -skin                  select a given skin
   -no-skin                      don't use any emulator skin
   -noskin                       same as -no-skin
    -memory                
物理内存大小MBs
    -netspeed             
最大网速 
    -netdelay             
网络延迟 
   -netfast                      disable network shaping
    -trace                 enable code profiling (F9 to start)
   -show-kernel                  
显示内核消息 
   -shell                        
终端启用root shell
   -no-jni                       disable JNI checks in the Dalvik runtime
    -nojni                        same as -no-jni
    -logcat                
查看日志 
   -no-audio                     disable audio support
   -noaudio                      same as -no-audio
    -audio              use specific audio backend
    -audio-in           use specific audio input backend
    -audio-out           usespecific audio output backend
   -raw-keys                     disable Unicode keyboard reverse-mapping
    -radio               
无线猫 
    -port                  
连接控制台的TCP端口.
    -ports , TCP ports usedfor the console and adb bridge

    -onion                use overlay PNG image over screen
    -onion-alpha
0 0