码迷,mamicode.com
首页 > 数据库 > 详细

【转载】How to Install & Setup ADB on Mac OS X

时间:2014-11-24 00:41:46      阅读:368      评论:0      收藏:0      [点我收藏+]

标签:android   http   io   ar   os   sp   java   for   strong   

文章转载自:https://seo-michael.co.uk/how-to-setup-adb-on-os-x/

Here is an easy to follow guide for setting up Android Debug Bridge (ADB) on your Mac.

  • Create a new directory on your Mac called android and place it somewhere easy to find
  • Download Android SDK (300+MB Download)
  • Unzip adt-bundle-mac-x86_64-20140702.zip
  • Rename unzipped directory to Android-SDK
  • Move the renamed directory Android-SDK to the android directory created in step 1
  • Open the Android-SDK directory
  • Navigate to /sdk/tools
  • Double click (you may need to right click and select open) the android file

bubuko.com,布布扣

This will execute a command in Terminal and open the Android SDK Manager window. If you don‘t have Java installed you will get a popup in which you will need to select More Info.. so you can download and install it.

  • In this window check Android SDK Tools & Android SDK Platform-Tools and select Install Packages. They may have already downloaded automatically, it is easy to tell if they have as the Install Packages button will be greyed out

bubuko.com,布布扣

If the above screen is blank you will need to check Updates/New & Installed and the necessary packages will appear.

bubuko.com,布布扣

In the next window that opens select:

  • Android SDK License
  • Accept License
  • Install

Installation will take a minute or two.

bubuko.com,布布扣

  • Open the original android directory created in the first step
  • Navigate to Android-SDK/sdk/platform-tools
  • Copy the adb file

bubuko.com,布布扣

  • Paste adb into the root of the original android directory created in step 1

This is pretty much completed. Now we need to test to make sure it is working correctly.

Connect your android device to your Mac. You must ensure that you have Android Debugging enabled on your device. This is done via Developer Options (a hidden setting) which is activated by pressing Build Number 7 times in Settings > About Phone on your device.

Once Android Debugging is enabled:

  • Open Terminal
  • Type cd followed by the path to the original android directory in step 1. In my case this would be

cd ~/Documents/android

bubuko.com,布布扣

  • Press Return
  • Type ./adb devices & press Return
  • Look at your your Android device as it may be asking you to Allow USB Debugging from your Mac. If it does then allow.

You should now see your device listed as an attached device. If you had to select allow on your Android device you may need to type ./adb devices again for it to appear as an authorised device.

bubuko.com,布布扣

You may see a message in Terminal saying

* daemon not running starting it now on port 5037 *
* daemon started successfully *

This is nothing to worry about; continue to follow setup.

If you followed the steps above and everything went as expected then ADB is now installed and functioning as it should.

You can now add a path using Terminal so you don‘t need to cd into the android directory and add ./ to every command.

  • Open Terminal
  • Type nano ~/.bash_profile
  • Press Return

bubuko.com,布布扣

You should have a Terminal window that looks something ike the one above. Copy the export PATH command below into your Terminal window replacing /Users/<yourusername>/Documents/android with the correct path to the original android directory you created way back in step 1.

export PATH=${PATH}:/Users/<yourusername>/Documents/android

bubuko.com,布布扣

  • Press Return
  • Press CTRL+X
  • Press Y to confirm
  • Press Return
  • Quit Terminal

You can now confirm this works by opening Terminal again and typing adb devices and you should see your device listed under attached devices without having to change directories.

bubuko.com,布布扣

【转载】How to Install & Setup ADB on Mac OS X

标签:android   http   io   ar   os   sp   java   for   strong   

原文地址:http://www.cnblogs.com/hoowang/p/4117759.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!