【轉載】How to Install & Setup ADB on Mac OS X

來源:互聯網
上載者:User

標籤: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

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

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

In the next window that opens select:

  • Android SDK License
  • Accept License
  • Install

Installation will take a minute or two.

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

  • 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

  • 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.

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

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

  • 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.

Share this post

【轉載】How to Install & Setup ADB on Mac OS X

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.