Android development environment built under Mac OS

Source: Internet
Author: User

                Android development environment built under Mac OS

Zhou Banhui

It is convenient to build Android environment under Mac OS, following several steps:

1. Installing the JDK

First figure out whether you have installed, under the command line: java-version, how to have version information output, it has been installed, such as my

192% java-version

Java Version "1.8.0_05"

Java (TM) SE Runtime Environment (build 1.8.0_05-b13)

Java HotSpot (TM) 64-bit Server VM (build 25.5-b02, Mixed mode)

Otherwise, the installation can be downloaded to http://www.oracle.com/technetwork/java/javase/downloads/index.html.

2, install Android Developer Tools (ADT)

To this page download: http://developer.android.com/sdk/index.html

Unzip to a directory, like mine:/applications/adt-bundle-mac-x86_64-20140321/

3, update path

ADT,JDK Many of these packages will be used later, in order to facilitate access, we need to put their paths down the PATH environment variable, so here we need to update the path

The syntax can be written like this (note that the following code is modified according to your own installation path and version):

Path= $PATH:/applications/adt-bundle-mac-x86_64-20140321/sdk/platform-tools:/applications/ adt-bundle-mac-x86_64-20140321/sdk/toolsjava_home=/library/java/javavirtualmachines/jdk1. 8. 0_05.jdk/contents/HomePath= $JAVA _home/bin: $PATHCLASSPATH=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jarexport java_homeexport classpathexport PATH

But where the code is placed depends on activating those files when the shell you're using starts, like bash activates ~/.BASHRC so you can append the code to ~/.BASHRC (no new)

Note: A lot of the Internet is for you to change. BASHRC. Bash_profile these, depending on the shell you use, such as zsh words should be modified ~/.ZSHRC

If you're not sure, switch your shell to bash first: chsh-s ' which bash '

After the configuration is complete, reopen Termal-typed adb version, if you can get the version information is OK.

4, Run eclipse

Open Eclipse in the ADT package that you just downloaded, and if you are prompted to install JRE 6, use the following method:

Open/library/java/javavirtualmachines/jdkxxxxx.jdk/contents/info.plist Follow the configuration below, and then restart your computer.

<Key>Jvmcapabilities</Key><Array>    <string>Jni</string>    <string>Bundledapp</string>    <string>Webstart</string>    <string>Applets</string>    <string>CommandLine</string></Array>

5. Configure the Android emulator in Eclipse or connect the Android phone

You can use the emulator to debug the program or you can use the physical phone, respectively, as follows

  Simulator:

Click "Windows", "Android Virtual Device Manager" from eclipse

In the pop-up window, click "New" to create a new one, in which you choose the resolution and the like, you configure, save, and then click "Start", then launched the simulator

  Cell phone:

Root the phone and turn on debug mode

Installing WiFi adb or similar software on your phone allows you to connect to the debugger with WiFi (or with a data cable)

Run WiFi adb and you will get an IP and port number

Open Termal on the computer to connect with ADB, for example: ADB connect 192.168.5.109:5555

6, write a small program in eclipse try

Open Eclipse New Project, new Android Application project, then write a button or whatever .... Omit 10,000 words ...

In the project folder right mouse button: Run as--Android application, will pop up a box lets you choose the simulator or the mobile phone, if the 5th step is configured successfully, this will be listed here. Select one, click OK, and your first Android app will run successfully!

  

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.