分类: LINUX
2010-08-18 09:53:32
下载
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
配置成功