Bought a MacBook, I thought I could tinker with iOS development and the like, but the tutor asked me to do Android development. Helpless started the work of developing Android on the MacBook.
From the start of the configuration environment to the success of the app running on the real machine is also twists, so here's a summary of how to configure the MacBook from scratch.
First, download the configuration ADT and SDK
With the popularity of Android devices, Google also simplifies the configuration of ADT and SDK, and now offers a consolidated ADT+SDK package for developers to download: http://wear.techbrood.com/sdk/index.html
In Google's view, after the download is complete, you can have everything you use for development:
- Eclipse + ADT Plugin
- Android SDK Tools
- Android Platform-tools
- A version of the Android platform
- A version of the Android system image for the emulator
When the download is complete, unzip it into a fixed folder, such as/development and then open Eclipse under adt-bundle-<os_platform>/eclipse/.
In accordance with the recommendations of the official website, continue to download the Supplemental SDK to meet the needs of development: http://wear.techbrood.com/sdk/installing/adding-packages.html
Next you can run a hello_android to test it!
Ii. Configuration of ADB
In Mac, you can use terminal commands for ADB and Android to help with debugging and so on. In fact, the above steps are finished, the ADB and other commands have been installed, the next only need to configure the MAC environment variables.
1. Go to User folder
1 CD ~
2. Modify the. bash_profile file
Vim. Bash_profile
3. Find your SDK path, mine is:/developer/applications/adt-bundle-mac-x86_64-20140702/sdk/add platform-tools and tools to the. Bash_ Profile, add the following two sentences:
Export path=${path}:/developer/applications/adt-bundle-mac-x86_64-20140702/sdk/platform-Tools Export PATH =${path}:/developer/applications/adt-bundle-mac-x86_64-20140702/sdk/tools
4. Quit Vim and close bash. After you reopen bash, you can test the ADB:
ADB version
If all goes well, it will appear as follows:
1.0. to
Like this, our environment variables are configured successfully!
Third, the Real machine debugging
Android developers know that Android's virtual machine is too slow to boot, and it's not as good as Apple's. So it is necessary to use the real machine debugging, but in the MacBook is a bit tortuous. ADB has been unable to successfully discover mobile phones, after the online reference to a number of solutions, finally succeeded! The main reason is actually one point: adb can not read the phone's vendor correctly, so the solution is to manually add this number to the ADB configuration file.
1, the test phone and MacBook connection is unblocked. It's critical that if the MacBook doesn't recognize the phone, then of course the ADB won't recognize it. The test method is to install a mobile phone helper on your Mac and see if the connection is normal. Recommended connection for an app: http://www.android-file-transfer.com
2. Run the command under Terminal:
System_profiler Spusbdatatype
Can get the phone parameter information: Find VendorID, copy out:
0x05ac
3. Modify the Adb_usb.ini file
Vim ~/.android/adb_usb.ini
Add: 0x05ac Save, exit.
4, this step is a very strange step, but really can not be missing: mouse click on the upper left corner of the window Apple flag--force quit-->finder--> Restart
5. Restart the ADB server:
kill-serveradb start-serveradb devices
If everything goes well, you'll see the list of mobile phones. Restarting eclipse can be a real-machine debug.
MacBook Android Development environment setup, real machine debugging