Mac OS X系统下的Android环境变量配置

来源:互联网 发布:淘宝售后服务流程图 编辑:程序博客网 时间:2024/05/21 09:11

在Mac下开发Android,要想在终端利用命令行使用adb/android等命令时,需要配置一下环境变量。

步骤:

1.首先,假设你已经下载了Android SDK,解压后安装了adb。记住sdk文件夹路径。我个人的路径为/Users/diqun/Destop/adt-bundle-mac-x86_64/sdk/

2.在终端中输入命令,进入用户目录。 

[plain] view plaincopy在CODE上查看代码片派生到我的代码片
  1. $cd ~  

3.然后输入命令,该命令的作用是如果不存在.bash_profile文件,则创建该文件

[plain] view plaincopy在CODE上查看代码片派生到我的代码片
  1. $touch .bash_profile  

4.然后输入命令,该命令的作用是用文本编辑器TextEdit打开.bash_profile文件。如果你是第一次配置环境变量,则该文档应该是空的。

[plain] view plaincopy在CODE上查看代码片派生到我的代码片
  1. $open -e .bash_profile  


5.下面要在该文件中加入下面的代码

1)将adb加入环境变量

[plain] view plaincopy在CODE上查看代码片派生到我的代码片
  1. export PATH=${PATH}:~/Destop/adt-bundle-mac-x86_64/sdk/platform-tools  
2)将android/ddms/emulator/sqlite3等加入环境变量

[plain] view plaincopy在CODE上查看代码片派生到我的代码片
  1. export PATH=${PATH}:~/Destop/adt-bundle-mac-x86_64/sdk/tools  

6.保存并退出TextEdit。关闭bash终端。

7.测试:

1)测试adb

[plain] view plaincopy在CODE上查看代码片派生到我的代码片
  1. $adb version  
显示

[plain] view plaincopy在CODE上查看代码片派生到我的代码片
  1. Android Debug Bridge version 1.0.31  
2)测试android
[plain] view plaincopy在CODE上查看代码片派生到我的代码片
  1. $android  
会打开Android SDK Manager窗口

OK,大功告成!

0 0