ubuntu android环境配置

1.下载eclipse

2.下载sdk

3.安装adt

4.配置sdk环境路径sudo gedit /etc/profile

export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:/home/liufei/program/java/sdk/tools:/home/liufei/program/java/sdk/platforms:$PATH

5.这时候会报一个类似Cannot run program "/sdk/build-tools/android-4.2.2/aapt: error=2的错误

由于我的ubuntu系统是64位的,而aapt工具需要32位库支持才能运行

因此执行:sudo apt-get install ia32-libs   安装32位库

6.连接真机测试(下面参考方法:http://my.oschina.net/u/561492/blog/89954)

解决方法:

切换到android sdk的platform-tools目录下(这一步很重要,必须要sudo,否则没效果)

sudo ./adb devices (这个主要是查看下已连接上的android机器)

List of devices attached

???????????? no permission(这个是小米手机,尚未识别)

semulator-5554 device(~。~我开了个android模拟器)

以下命令是:重启adb服务,再输入adb devices就应该能找到设备了。

sudo ./adb kill-server

sudo ./adb devices

(注意:这两个命令要连起来,即不要等第一条命令执行一段时间后在执行第二条命令,这样就没效果了。在第一条命令执行时,Eclipse的控制台会输出如下信息:

[2013-03-14 10:53:40 - DeviceMonitor] Connection attempts: 1
[2013-03-14 10:53:41 - DeviceMonitor] Connection attempts: 2
[2013-03-14 10:53:42 - DeviceMonitor] Connection attempts: 3
[2013-03-14 10:53:43 - DeviceMonitor] Connection attempts: 4
[2013-03-14 10:53:44 - DeviceMonitor] Connection attempts: 5
[2013-03-14 10:53:45 - DeviceMonitor] Connection attempts: 6
[2013-03-14 10:53:46 - DeviceMonitor] Connection attempts: 7
[2013-03-14 10:53:47 - DeviceMonitor] Connection attempts: 8
[2013-03-14 10:53:48 - DeviceMonitor] Connection attempts: 9
[2013-03-14 10:53:49 - DeviceMonitor] Connection attempts: 10
[2013-03-14 10:53:50 - DeviceMonitor] Connection attempts: 11

一定要注意,必须要在控制台输出完这些信息之前执行第二条命令:sudo ./adb start-server

7.最后本来想上一张图,可是刚接触ubuntn,说实话不会姐图,打字也不方便。

原文地址:https://www.cnblogs.com/fanglove/p/3209779.html