Build an android environment (Windows)

Source: Internet
Author: User

Preface

I have seen a lot of articles about Android recently, and I am eager to experience android, so I found some articles on how to build android in windows on the Internet. I would like to share with friends who are not getting started and interested in me. I hope you will be helpful.

Body

  Download

1 download JDK http://www.oracle.com/technetwork/java/javase/downloads/index.html.

2. If there is no eclipse, you also need to download an eclipse http://www.eclipse.org/

3 SDK download http://developer.android.com.nyud.net/sdk/index.html

4 ADT (Android development tools) download the same page

  Install

1. Install JDK and configure the environment variables.

Configuration method http://tieba.baidu.com/F? Kz= 899066778

2. Install eclipse (if not)

3. Configure/install the android SDK

3.1 Add the installation path to JDK java_home configuration and test the command Android -- help. If any help information is displayed, the configuration is successful.

3.2 open setup.exe in the sdkinstallation directory

Note: perform the following settings before installing the SDK:

        

Then, click installed packages to install an SDK platform (you can also choose to install it all, but you must install at least one. Otherwise, you cannot create an avd vm)

4. Install ADT

4.1 open eclipse and select help-install new software from the navigation menu. In work with, enter https://dl-ssl.google.com/android/eclipse/ add and enter name: Take a meaningful, all selected installation, after the completion of the restart eclipse.

4.2 configure the SDK path in eclipse, select Windows> preferences> Android, and select the location of the android SDK.

5. Create an AVD (Android virtual device)

Open eclipse, select windows-android SDK and AVD manager, and then

      

If there is no AVD at first, you need to click New and then the dialog box shown in the figure will appear. Then, enter name: to obtain a meaningful vertex that will be used later, and enter size, target selects an SDK platform (installed in step 3), which can be used by default. Click Create AVD and then OK.

6. Start the simulator.

Run cmd to go to the tool directory of the SDK and enter the name of step 5 of the command emulator-AVD. The following will appear in a short time:

      

7. The above interface indicates that the installation is successful.

  Example

1. Create an android project. If the environment is successfully installed, see:

    

2 Sample Code

        

Code

 package test.android;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

public class HelloWorld extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TextView tv = new TextView(this);
tv.setText("Hello Android");
setContentView(tv);
}
}

 

Then run the project (CTRL + F11), select androin application, and run. The simulator starts slowly. The following figure appears after waiting patiently:

    

The first Android hello program is finally completed. Wish everyone a smooth job and study!

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.