Build the macbookandroid development environment, debug the real machine, and macbookandroid
I bought a MacBook and thought I could beat up iOS development. Unfortunately, my mentor asked me to do Android development. Instead, I started developing Android on a MacBook.
From the start of Environment configuration to the successful running of the application on the real machine, it is also a breeze, so here we will summarize how to configure the MacBook from scratch.
1. Download and configure ADT and SDK
With the popularity of Android devices, Google also simplifies the ADT and SDK configuration process, now provides integrated ADT + SDK package for developers to download: http://wear.techbrood.com/sdk/index.html
In Google's saying, after downloading, you can have everything you use for development:
- Eclipse + ADT plug-in
- Android SDK Tools
- Android Platform-tools
- A version of the Android platform
- A version of the Android system image for the emulator
After the download is complete, decompress the package to a fixed folder, such as/Development, and open eclipse under adt-bundle-<OS _platform>/eclipse.
According to the recommendations of the official website, continue to download the supplementary SDK to meet the development needs: http://wear.techbrood.com/sdk/installing/adding-packages.html
Next, you can run hello_android to test it!
2. Configure adb
In mac, you can use the terminal commands adb and android to help debugging. In fact, after the above steps are completed, the adb and other commands have been installed. Next, you only need to configure the mac environment variable.
1. Enter the user folder
1 cd ~
2. Modify the. bash_profile File
vim .bash_profile
3. Find your SDK path, and add platform-tools and tools to the. bash_profile file in/Developer/Applications/adt-bundle-mac-x86_64-20140702/sdk:
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. Exit vim and disable bash. After bash is re-opened, you can test adb:
adb version
If everything goes well, it will be shown as follows:
Android Debug Bridge version 1.0.31
In this way, our environment variables are successfully configured!
3. Real machine debugging
Anyone who has done Android development knows that it is too slow for the Android Virtual Machine to start. It is not as easy as apple's. So it is necessary to use a real machine for debugging, but it is a bit tortuous in the macbook. Adb has never been able to find a mobile phone. After reading many solutions on the internet, it finally succeeded! The main reason is that adb cannot correctly read the vendor number of the mobile phone, so the solution is to manually add this number to the adb configuration file.
1. test whether the connection between the mobile phone and the MacBook is smooth. This is critical. If the MACOs cannot recognize their mobile phones, the adb will certainly not recognize them. The test method is to install a mobile assistant on the mac and check whether the connection is normal. Recommended connection to an app: http://www.android-file-transfer.com
2. Run the following command on the terminal:
system_profiler SPUSBDataType
You can get the parameter information of the mobile phone: Find the vendorID and copy it:
Vendor ID: 0x05ac
3. Modify the adb_usb.ini File
vim ~/.android/adb_usb.ini
Add: 0x05ac save and exit.
4. This step is a strange step, but it cannot be missing: Click the apple icon in the upper left corner of the window --> force exit --> Finder --> restart
5. Restart the adb Server:
adb kill-serveradb start-serveradb devices
If everything goes well, you will see the mobile phone list. Restart eclipse to debug the real machine.
How to build an android development environment and how to debug a real machine
The environment is easy to build. There are a lot of searches, so you can debug the real machine and enable USB debugging.
Development and debugging of the Android system source code and how to build the development environment
Compile on the linux terminal. The./build/envsetup. sh choosecombo mmm android Source Code cannot be compiled in eclipse. If the system apps are imported to eclipse, an error is reported! Debugging you can call log debugging. You cannot use debug to compile on the terminal!