Android Environment Setup

Source: Internet
Author: User

Introduction

This series is suitable for 0 basic personnel, because I am starting from 0, this series record I step into the Android development of some experience sharing, hope and June Mutual encouragement! As a new person in the Android team I, if there is something wrong, but also hope to enlighten.

Before starting the Android development journey, first build the environment and then create a simple HelloWorld. The topics in this article are as follows:

    • 1. Environment construction
      • 1.1. JDK Installation
      • 1.2. Eclipse Installation
      • 1.3. Android SDK Installation
      • 1.4. ADT Installation
      • 1.5. Create AvD
    • 2, HelloWorld
1. Environment Construction 1.1. JDK Installation

If you do not have the JDK, you can go here to download, the next task is to install the prompt step-by-step. The steps for setting environment variables are as follows:

    1. The following environment variables are added to the system variables, such as environment variables, properties---
    2. The Java_home value is: D:\Program files\java\jdk1.6.0_18 ( the directory where you installed the JDK )
    3. The Classpath value is:.; %java_home%\lib\tools.jar;%java_home%\lib\dt.jar;%java_home%\bin;
    4. Path: Append%java_home%\bin at the beginning;
    5. Note: setting environment variables in the previous four steps is not necessary for building an Android development environment and can be skipped.

After the installation is complete, you can check that the JDK is installed successfully. Open the cmd window and enter Java–version to view the version information for the JDK. A screen similar to the following shows that the installation was successful:

Figure 1, verifying that the JDK installation is successful

1.2. Eclipse Installation

If you still have eclipse, you can download it here and download the win 32bit version of Eclipse IDE for Java Developers (92M) as shown:

Figure 2, Eclipse download

Can be used after decompression.

1.3. Android SDK Installation

On Android developers download android-sdk_r05-windows.zip, download (HTTP://ISHARE.IASK.SINA.COM.CN/F/22318719.HTML?FROM=DL) and unzip to any path after completion. The Sina information has the following

    • Run SDK Setup.exe, and click Available Packages. If you do not see an installable package, click Settings, select "Force https://..." in misc, and then click Available Packages.
    • Select the SDK and its documentation or other packages you wish to install, click Installation Selected, Accept all, install Accepted to begin downloading and installing the selected package

Problems encountered:

Failed to fetch URL http://dl-ssl.google.com/android/repository/repository.xml

Solve:

Failed to Fectch URl Https://dl-ssl.google.com/android/repository/addons_list.xml, reason:connection to https:// Dl-ssl.google.com refused
The solution stems from:code.google.com

    • Open the Hosts file in C:\WINDOWS\system32\drivers\etc with Notepad
    • Add 74.125.237.1 dl-ssl.google.com on the last line
    • Solve the problem successfully.

    • The new path value in the user variable is: the tools absolute path in the Android SDK (this machine is D:\AndroidDevelop\android-sdk-windows\tools).

Figure 2, setting environment variables for Android SDK

After "OK", restart the computer. After restarting the computer, go to the cmd Command window and check that the SDK is installed successfully.
Run Android–h If you have output similar to the following, it indicates that the installation was successful:

Figure 3, verifying that the Android SDK is installed successfully

1.4. Eclipse Plug-in ADT installation
    • Open the Eclipse IDE and go to "help", "Install New Software" in the menu
    • Click Add ... button, the pop-up dialog asks you to enter name and location:name yourself, location input http://dl-ssl.google.com/android/eclipse. As shown in the following:

    • After determining the return, select the ADT we just added in the drop-down list after work with, and we'll see the developer Tools below that expand it will have Android Ddms and Android development Tool, tick them. As shown in the following:

    • Then just follow the prompts step by step next.

Install SDK Manager after reboot

After completion:

    • Choose Window > Preferences ...
    • On the left panel select Android, then on the right click Browse ... and check the SDK path, this machine is:
      D:\AndroidDevelop\android-sdk-windows
    • Click Apply, OK. Configuration is complete.
1.5. Create AVD

To enable Android applications to run on the emulator, you must create an AVD.

The new version of SDK Manager and AVD Manager are separate

    • 1. In Eclipse. Select Windows > Android SDK and AVD Manager
    • 2. Click Virtual Devices on the left panel, then click New on the right.
    • 3, fill in the name, select the target API,SD card size arbitrary, skin random choice, hardware currently keep the default value
    • 4. Click Create AVD to complete the AVD creation

Note: If you click on the left panel of virtual Devices, and then click New on the right, and the target drop-down list is not available, then you:

    • Click Available Packages on the left panel and tick https://dl-ssl.google.com/android/repository/repository.xml on the right, as shown in:

    • Then click the Install Selected button and follow the prompts.

To do both of these, the reason is that in 1.3, the Android SDK installation did not install some of the necessary available packages (Available Packages).

The AVD cannot be created successfully, and the SDK Manager is installed completely before it is established.

2, HelloWorld

The new version is built with Android application project

    • Create a new project "Android Project" Through the Project menu, file-I
    • Then fill in the necessary parameters as shown in: (Note here I checked the Google APIs, you can choose what you like, but you want to create the appropriate AVD)

Description of the relevant parameters:

  1. Project name: The names of the folders that contain this project.
  2. Package Name: Packages name, following Java specification, it is important to distinguish different classes by package name, I use Helloworld.test.
  3. Activity name: This is the main class name of the project, and this class will be the subclass of the activity class of Android. An activity class is a simple launcher and control program class. It can create an interface as needed, but it is not required.
  4. Application Name: An easy-to-read title on your application.
  5. The "Use default location" option in the "Selection bar" allows you to select an existing project.
    • After clicking Finish, click on the eclipse's Run menu to select Run configurations ...
    • Select "Android Application", click on the upper left corner (button like a piece of paper with a "+" number) or double-click "Android Application", there is a new option "New_configuration" ( can be changed to our favorite name ).
    • In the right Android panel, click Browse ..., select HelloWorld
    • Tick the appropriate AVD in the automatic of the target panel, and if there is no AVD available, you need to click on the manager in the lower right corner and create the appropriate AVD. As shown in the following:

    • Then click the Run button, and if successful, there will be an Android emulator interface, as shown in:

Android Environment Setup

Related Article

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.