$sudo fdisk -l //查看挂载的u盘,选择w95 fat32系统那个
$sudo mount /dev/sdc1
//挂载u盘,会提示挂到 /media/UBUNTU下
$sudo cp android-ndk-r8c-linux-x86.tar.bz2 /home/
$cd /home
$sudo tar jxvf android-ndk-r5b-linux-x86.tar.bz2
//解压ndk包,时间大概2分钟
$sudo cd android-ndk-r8c/
$vi ~/.bashrc //添加NDK环境变量
在最后加上
export PATH=${PATH}:/home/android-sdk-linux/tools
export PATH=${PATH}:/home/android-sdk-linux/platform-tools
export PATH=${PATH}:/home/android-ndk-r8c
这样就搭建好了ndk环境
安装android sdk
.下载Android SDK for linux包,地址:http://dl.google.com/android/android-sdk_r10-linux_x86.tgz
最新的:http://developer.android.com/sdk/index.html
.sudo cp android-sdk_r10-linux_x86.tgz
.sudo tar zxvf android-sdk_r10-linux.tgz
# tools/android
//启动SDK manager
安装jdk
.下载Sun-java6-jdk,不是ubuntu 自带的default-jdk或openjdk-6-jdk
.#mkdir /opt/java
//opt目录存放linux第三方软件
.#tar zxvf ./jdk-7u9-linux-i586.gz -C /opt/java
//解压到指定目录
.配置环境变量
$ sudo gedit /etc/environment
在environment中修改PATH,追加JDK路径,添加CLASSPATH与JAVA_HOME后如下:
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/opt/java/jdk1.7.0_09/bin"
CLASSPATH="/opt/java/jdk1.7.0_09/bin"
JAVA_HOME="/opt/java/jdk1.7.0_09"
然后就是要告诉系统,我们使用的sun的JDK,而非OpenJDK了:
$ sudo update-alternatives --install /usr/bin/java java /opt/java/jdk1.7.0_09/bin/java 300
$ sudo update-alternatives --install /usr/bin/javac javac /opt/java/jdk1.7.0_09/bin/javac 300
$ sudo update-alternatives --config java
参考:
http://147731489.blog.sohu.com/227882005.html