Chinaunix首页 | 论坛 | 博客
  • 博客访问: 277879
  • 博文数量: 91
  • 博客积分: 1772
  • 博客等级: 上尉
  • 技术积分: 930
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-17 19:49
文章分类

全部博文(91)

文章存档

2012年(1)

2011年(36)

2010年(50)

2008年(4)

我的朋友

分类: LINUX

2010-08-18 09:53:32

Ubuntu android NDK 配置

文章分类:移动开发

下载
Windows    
Mac OS X (intel)           

Linux 32/64-bit (x86)    

在ubuntu下只需下载linux版本的就行

下载后将文件解压,在终端进入解压后的目录中

第一步:make -v 和 gcc -v 检测

用make -v出现如下提示:

root@liuyuan-desktop:/home/work/android-ndk-1.6_r1# make -v
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

 这个程序创建为 i486-pc-linux-gnu


用gcc -v出现如下提示:

root@liuyuan-desktop:/home/work/android-ndk-1.6_r1# gcc -v
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.4.3-4ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4 --program-suffix=-4.4 --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-plugin --enable-objc-gc --enable-targets=all --disable-werror --with-arch-32=i486 --with-tune=generic --enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu
Thread model: posix
gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5)

 

第二步: 检测没有错误,输入命令: ./build/host-setup.sh

会出现错误

错误修改:

编辑 build/host-setup.sh 修改#!/bin/sh 为#!/bin/bash 保存

再次输入 ./build/host-setup.sh ,可以看到没错:

root@liuyuan-desktop:/home/work/android-ndk-1.6_r1# ./build/host-setup.sh
Checking host development environment.
NDK Root   : /home/work/android-ndk-1.6_r1
GNU Make   : make (version 3.81)
Awk        : awk
Platform   : linux-x86
Generate   : out/host/config.mk
Toolchain  : Checking for arm-eabi-4.2.1 prebuilt binaries

Host setup complete. Please read docs/OVERVIEW.TXT if you don't know what to do.

 

第三步:接着编译 samples 里的例子: make APP=hello-jni

第四步:用eclipse添加刚编译的工程(前提是已经配置好了android sdk,adt)

 

运行模拟器将会看到

hello-jni

配置成功

阅读(2337) | 评论(0) | 转发(1) |
给主人留下些什么吧!~~