Step 1: Build the android Environment

Source: Internet
Author: User
Tags windows x86 java se

Reference: http://www.cnblogs.com/skynet/archive/2010/04/12/1709892.html

 

Suddenly I changed my cell phone. In order to be able to afford the support of my family, Android should at least learn it. Even if it is not so powerful, it cannot be a shame. 0. The first step is to set up the android environment. All kinds of information on the Internet can be processed by Baidu. It is basically built based on the above website.

 

To do well, you must first sharpen your tools.

First, download all necessary things:

1. Java SDK

Http://www.oracle.com/technetwork/java/index.html

Java official website, new downloads on the right-> Java SE 7 Update 10 (Latest Version)-> JAVA Platform (JDK) 7u10 (first Java image download)

Then, drag down the accept license agreement (indicating that you accept the Protocol) and Select Download based on your operating system in the options below. LZ is the 64-bit Windows 7 7, therefore, Windows x86 is downloaded.

 

2. Development Tools --- eclipse

Http://www.eclipse.org/downloads/ eclipse official website, the same way to download the latest version of the line

 

3. Android ---- Android Developers

Http://developer.android.com/sdk/index.html click the big picture download the SDK and then pull down to agree his protocol to download according to the number of digits of his system on the line, LZ selected 64-bit ..

 

After downloading three things on three sides, you can start to build the android environment.

The following content is basically the same as the content in the beginning of the article, interspersed with personal problems.

 

First, install the Java SDK first. It is best to install it on drive C by default, which is basically the default path. Eclipse downloads a RAR decompression package, which can be ignored temporarily. Android Developers is also downloaded as a RAR. After decompression and decompression, an eclipse is included in it (because there are many problems, so ···)

Run the SDK manager.exe to check all the optional boxes (in fact, I do not quite understand what it means, it should be a version of the API? All go down ..) Then click Install packages .. to install the package. Then it will be automatically installed and downloaded online. After all the installation is complete, the bottom sort by: originally, the "API level" is checked, the "repository" is checked, and then the above is checked again at the next install packages ..

LZ is not good at English. · if you cannot do anything, install it all .. After installation, you can close this program.

 

Then configure the environment

 

  1. Choose my computer> Properties> advanced> environment variables> system variables to add the following environment variables:
  2. Java_home: D: \ Program Files \ Java \ jdk1.6.0 _ 18 (Directory where you install JDK)
  3. Classpath value:.; % java_home % \ Lib \ tools. jar; % java_home % \ Lib \ DT. jar; % java_home % \ bin;
  4. Path: Start appending % java_home % \ bin;
  5. Note:Setting environment variables in the previous four steps is not necessary for building an android development environment. You can skip this step.

After the installation is complete, check whether the JDK is successfully installed. Open the CMD window and enter Java-version to view the JDK version. The following figure shows that the installation is successful:

Figure 1. Verify that JDK is successfully installed

 

You can retrieve the links directly. LZ is shameless ···

 

 

Then the android SDK

 

  • Create a path in the user variable with the absolute path: tools in the android SDK (for example, lz is D: \ Android \ adt-bundle-windows-x86_64 \ SDK \ tools ).

    Figure 2. Set android
    SDK Environment Variables

    After "OK", restart the computer. After restarting the computer, enter the CMD command window and check whether the SDK is successfully installed.
    If Android-H has the following output, the installation is successful:

    Figure 3. Verify android
    Is the SDK installed successfully?

     

     

    Then install ADT.

     

    Note: Before ADT is installed, the latest version of eclipse just downloaded takes effect. Maybe the new version of Android environment is more user-friendly and everything has been downloaded. However, eclipse in LZ is a variety of errors, or the SDK cannot be found, (After the SDK's Jer is copied) it becomes unable to load some libraries.

    In fact, this eclipse should be set up in everything, but it is a pity that LZ will not, so we will continue to set it according to the reference article.

    Before installing the ADT, delete all the eclipse folders under Android Developers, and decompress the latest version of eclipse downloaded here. Run this eclipse and install ADT as follows.

     

  • Open Eclipse IDE and choose "help"-> "install new software" from the menu"
  • Click Add.... In the displayed dialog box, enter name and location: name, and enter http://dl-ssl.google.com/android/eclipse. As shown in:

    • After the return result is confirmed, select the ADT we just added from the drop-down list after work with. We will see the developer tools below, which will show Android ddms and Android development tools, select them. As shown in:

    • Next, follow the prompts to proceed to the next step.

    After completion:

    • Select WINDOW> preferences...
    • Select android on the left-side panel, Click Browse... on the right side, and select the SDK path. The local machine is:
      D: \ androiddevelop \ Android-SDK-Windows
    • Click Apply and OK. Configuration complete.

     

    Note: In actual operations, there may be gaps in the interface. For example, you can check all the items you can select. The original version may be earlier than the current version when the original author installs it.

     

     

    Create AVD

    To enable the Android Application to run on the simulator, you must create an AVD. (It is actually an android simulator, equivalent to a virtual phone)

     

  • 1. In eclipse. Choose Windows> Android Virtual Device Manager
  • 2. Click Android virtual devices on the left panel, and then click New on the right.
  • LZ post a picture

     

    Glossary:

    AVD name: the name of the simulator (AVD ).
    Device: device. Can you choose a device based on the resolution of your mobile phone? The resolution of the LZ Xiaomi 1 s youth edition is 480*854, so I chose this
    Target: select the last one.
    Keyboard: Specifies the virtual keyboard. Remember to check it out.
    Skin: I don't know .. Check it out.
    Ram: runtime memory. I cannot run the 1g simulator. I don't know why, so it is default.
    SD card: Size: I don't know how much it will be. If I increase it, I can't do it. It requires at least 9 M. LZ will give it 128 (the unit can be selected later, please pay attention)

     

    Click OK to create an AVD.

    Can you Click Refresh to refresh it? Then you can close the window and the AVD is created successfully! (You can select this option to run your program when running the program)

     

    At this point, the android environment has basically been successfully set up, and it seems that you have not forgotten any steps.

     

    Then there is the classic Hello World

     

    Use the file-> New-> Project menu to create the "Android Application project" under the "android" folder of the new project"

    Click Next.

     

    Application name: Enter =. = Project name .. Next

     

    Deselect the Create Project in Workspace option and select a path. This path is the path of your project.

    Next, click Next, and there is an active name (like this ?) You can modify the name, which will be the name of a. Java File Created by the project.

     

    After the project is successfully created, there will be a package under the SRC project. The file in the package is the name you just set.

     

    Double-click the mainactivity. Java

    Add reference

    Import Android. App. activity;

    Import Android. OS. Bundle;
     
    Import Android. widget. textview;

     

    Then, replace the content in the mainactivity class with the following content:

    /** Called when the activity is first created .*/

    @ Override
     
    Public void oncreate (bundle saveinstancestate ){
     
    Super. oncreate (saveinstancestate );
     
    // Setcontentview (R. layout. Main );
     
    Textview TV = new textview (this );
     
    TV. settext ("helloworld ");
     
    Setcontentview (TV );
     
    }

     

    Click the green triangle above and select Android Application

    Now you can select the AVD you just created and check the options in the lower left corner. (If you want to change the AVD or modify the AVD parameters, you can modify them in the workspace, be sure to hook up the keyboard. OH)

    At this time, the simulator will start to run. The first running will take a long time, and LZ will forget how long it will take... A little long

    Finally, the effect Hello world has finally come out. After my android self-study, I have finally begun! Come on!

     

    Finally, I would like to thank the blogger again for posting his blog path:

    Http://www.cnblogs.com/skynet/archive/2010/04/12/1709892.html

     

  • 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.