【玩转Ubuntu】02. Ubuntu上搭建Android开发环境

时间:2023-03-09 00:43:24
【玩转Ubuntu】02. Ubuntu上搭建Android开发环境

一. 基本环境搭建

1.官网http://developer.android.com/sdk/index.html ,下载adt-bundle-linux-x86_64-20130729.zip

2. 解压sdk

bixiaopeng@bixiaopeng-To-be-filled-by-O-E-M:~/soft$ unzip adt-bundle-linux-x86_64-20130729.zip
bixiaopeng@bixiaopeng-To-be-filled-by-O-E-M:~/soft$ ls -al
总用量 1098596
drwxrwxr-x 6 bixiaopeng bixiaopeng 4096 8月 21 11:48 .
drwxr-xr-x 26 bixiaopeng bixiaopeng 4096 8月 21 13:06 ..
drwxr-x--- 4 bixiaopeng bixiaopeng 4096 7月 29 15:23 adt-bundle-linux-x86_64-20130729
-rw-rw-r-- 1 bixiaopeng bixiaopeng 458006784 8月 20 20:59 adt-bundle-linux-x86_64-20130729.zip

3.配置环境变量

vim ~/.bashrc  把下面这些环境变量加进去
export ANDROID_SDK=/home/bixiaopeng/soft/adt-bundle-linux-x86_64-20130729/sdkexport PATH=$ANDROID_SDK/platform-tools:$ANDROID_SDK/tools:$PATH

4.测试一下

bixiaopeng@bixiaopeng-To-be-filled-by-O-E-M:~/soft$ adb shell
error: device not found

返回以上信息就表明你配置成功了

二. 使用android提供的eclipse

使用android提供的绑定ADT的eclipse开发,这样就不用在eclipse里安装ADT插件了

bixiaopeng@bixiaopeng-To-be-filled-by-O-E-M:~/soft/adt-bundle-linux-x86_64-20130729$ ls
eclipse sdk

【玩转Ubuntu】02. Ubuntu上搭建Android开发环境

三. 使用Android Studio

1. 下载地址:http://developer.android.com/sdk/installing/studio.html
我下载的是: Android Studio v0.2.xfor Linux

2. 下载下来后怎么样打开Android Studio呢?
#  到android-studio/bin目录下执行studio.sh

bixiaopeng@bixiaopeng-To-be-filled-by-O-E-M:~/soft$ cd android-studio/bin
bixiaopeng@bixiaopeng-To-be-filled-by-O-E-M:~/soft/android-studio/bin$ ls -al
总用量 128
drwxr-x--- 2 bixiaopeng bixiaopeng 4096 8月 21 13:24 .
drwxr-x--- 7 bixiaopeng bixiaopeng 4096 7月 12 00:27 ..
-rw-r----- 1 bixiaopeng bixiaopeng 136 7月 11 23:48 appletviewer.policy
-rwxr-x--- 1 bixiaopeng bixiaopeng 22791 7月 11 23:48 fsnotifier
-rwxr-x--- 1 bixiaopeng bixiaopeng 29155 7月 11 23:48 fsnotifier64
-rw-r----- 1 bixiaopeng bixiaopeng 4176 7月 11 23:48 idea.png
-rw-r----- 1 bixiaopeng bixiaopeng 6913 7月 11 23:48 idea.properties
-rwxr-x--- 1 bixiaopeng bixiaopeng 281 7月 11 23:48 inspect.sh
-rw-r----- 1 bixiaopeng bixiaopeng 8531 7月 11 23:48 libbreakgen64.so
-rw-r----- 1 bixiaopeng bixiaopeng 6807 7月 11 23:48 libbreakgen.so
-rw-rw-r-- 1 bixiaopeng bixiaopeng 0 8月 21 13:24 libpeerconnection.log
-rw-r----- 1 bixiaopeng bixiaopeng 2275 7月 11 23:48 log.xml
-rw-r----- 1 bixiaopeng bixiaopeng 282 7月 11 23:48 studio64.vmoptions
-rwxr-x--- 1 bixiaopeng bixiaopeng 6505 7月 11 23:48 studio.sh
-rw-r----- 1 bixiaopeng bixiaopeng 290 7月 11 23:48 studio.vmoptions
bixiaopeng@bixiaopeng-To-be-filled-by-O-E-M:~/soft/android-studio/bin$ sh studio.sh

提示:JDK一定要用1.6的,第一次打开的时候会让你指定JDK1.6的路径

3.配置Android Studio环境变量

#查看路径
bixiaopeng@bixiaopeng-To-be-filled-by-O-E-M:~/soft/android-studio/bin$ pwd
/home/bixiaopeng/soft/android-studio/bin
#编辑.bashrc
bixiaopeng@bixiaopeng-To-be-filled-by-O-E-M:~/soft/android-studio/bin$ vim ~/.bashrc
#在底部增加下面的配置
export ANDROID_STUDIO=/home/bixiaopeng/soft/android-studio/bin
export PATH=${ANDROID_STUDIO}:$PATH
#让配置立即生效
bixiaopeng@bixiaopeng-To-be-filled-by-O-E-M:~$ source ~/.bashrc
#在任意路径下都可以直接打开studio
bixiaopeng@bixiaopeng-To-be-filled-by-O-E-M:~/soft/android-studio/bin$ cd ~
bixiaopeng@bixiaopeng-To-be-filled-by-O-E-M:~$ studio.sh

【玩转Ubuntu】02. Ubuntu上搭建Android开发环境