[Original] Development of the first Android Program (Tutorial series), Android tutorial

Source: Internet
Author: User
Tags android sdk manager

[Original] Development of the first Android Program (Tutorial series), Android tutorial

[Personnel oriented]: All Android Developers are determined to start from scratch;
[Tutorial description]: The content of this tutorial must be original, concise, and detailed. The attachment link must be available, up-to-date, and complete;
[Reply description]: The tutorials are unclear. Please reply to the interaction in a timely manner. The landlord will update the post as soon as possible, so as to open source, share, and develop.

1. Update SDK online through proxy

Open the development folder created in android 001, android/develope, and find and double-click the executable file of SDK Manager.exe.

Wait a moment. The Android SDK Manager Log window is automatically displayed. If no proxy money is configured in the window, various error messages indicating connection failure or disconnection will be displayed.

TIPS: Google is strong and cannot be updated without proxy. This tutorial provides free IP addresses and ports for you to update and use.

Open the Tools/options menu of Android SDK Manager, and the Android SDK Manager-Settings window is automatically displayed.

HTTP Proxy Server: indicates the HTTP Proxy Server address.

HTTP Proxy Port: indicates the Port address of the HTTP Proxy server.

TIPS: This tutorial provides a free port and is available for test. You can select either of the following lines and copy the IP address and port to the corresponding option.

IP Port location

108.165.33.4 3128 USA
71.96.39.147 80 Res, Virginia
108.165.33.11 3128 USA
108.165.33.8 3128 USA
108.165.33.6 3128 USA
108.165.33.3 3128 USA
192.3.21.243 8118 North America

TIPS: After the configuration is successful, the Android SDK Manager interface lists the API packages of Android 1.5 to 4.4 and other versions. If not displayed, try using an IP address.
TIPS: The above IP address is only temporarily available. You can configure the permanent proxy mode as follows: high-speed, stable, free, and harmonious (one-time permanent configuration)

After configuration, on the Android SDK Manager interface, open the Packages menu and select Sort by Api Level.

Select the corresponding packages, click Install package, select all items, Select Accept, and click Install

TIPS: If a warning message is displayed, select "no". wait a few minutes. The progress bar at the bottom of the page displays the download speed and installation progress. It is estimated that the download and installation will be completed in about one hour, the installation speed is determined by the customer's network speed.

2. Configure the eclipse environment and create and develop an Android APP

Open the eclipse program: Open the development folder created in android 001, android/eclipse, and find the executable file of eclipse.exe.

TIPS: this operation process is a regular development operation.

Set the workspace: ADT development interface, open the menu items in sequence: File/switch workspace/others, select the workspace folder created in the 001 tutorial by default, and click OK, then the ADK program restarts automatically, and the system restarts and regrets loading the android project of the workspace.

Load the updated SDK package: Java-ADT program interface, open the menu items, window/preferences, select the left menu Android, select the browser sdk directory

SDK Location: browse and select the sdk directory under the development folder.

After selecting the directory, you can view all the android APIs and click OK to exit the current preference interface.

Create the first Android program: Java-ADT interface, open the menu items, file/New/Project, select the Android Application Project under the Android menu, and click Next

After a new window is displayed, three text boxes and four drop-down selection boxes are displayed in the new window interface.

Application Name: Application Name

Project Name: Project Name

Package Name: Package Name, which is also a unique id

Minimum Required SDK: The Minimum SDK version supported by your program. Set the default item in the tutorial.

Target SDK: the SDK version of the current Target program.

Compile With: the SDK version compiled by the current target program

Theme: The Theme style that comes with Android. Select the default one.

Tip: After filling in the Application Name, you can select the default option. By default, you can click "Next" and "finish" four times. The program is created in minutes based on your options and automatically enters the source code interface, after the project is created, the source code of the Project is displayed in the package Resource Manager window.

3. Run the program using the android Simulator

The ADT interface opens the menu items in sequence. The window/Android Virtual Device Manager enters the Android Virtual Device Manager.

TIPS: Android Virtual Device Manager: it is an Android simulation Manager used for visual management of Android PC.

Select new on the current page. The AVD page is displayed.

AVD Name: Name. You can customize it.
Device: Device. from the drop-down menu, we recommend that you select a Device with a lower resolution for testing. This tutorial uses 4.0 "WVGA (480x800: hdpi)
Target: The Target SDK. In this tutorial, choose Android 2.3.3-API level 10.
CPU/ABI: instruction set, default
Keyboard: the Keyboard is selected by default.
Skin: selected by default, skin
Front Camera: front Camera, default
Back Camera: rear Camera
Memory Options :( RAM: Memory is more than 512, VM Heap: system cache, 32 recommended)
Internal Storage: the memory size used when the APP is installed.
SD Card: (size:, file external SD Card, which is left blank by default
Emulation Options :( Snapshot:, Use Host GPU) simulation Options

Tip: the Snapshot in the simulation option means "Snapshot", which can save the status when AVD is disabled, and then display the status when the next startup is disabled, similar to the cache mechanism. If you select the check box, what will happen? Some of the tips are as follows: I changed the code clearly and it didn't work. We recommend that you check this setting. We do not recommend this option in this tutorial. Use Host GPU is a computer GPU. It is not recommended to select this tutorial.

AVD: AVD is called Android Virtual Device, which is a Virtual Device running on Android. It is recognized by the Android simulator. To run a created Android program, you must create an AVD. You can configure many running projects on each AVD.

After entering the options, click "OK". You can see an additional line of information just configured in the list of the Android Virtual Devices Manager interface.

On the Android Virtual Devices Manager page, click the Start button to bring up the Launch Options interface. On the confirmation page before the Launch, click Launch. The Android simulator starts. The current debugging environment simulates the real boot interface.

TIPS: The simulator usually runs slowly, mainly affected by the configuration of the Computer Host (the main user entered the program interface within 10 seconds)

After the program is fully started. You can find that the simulator is the same as a real mobile phone, and you can perform some basic and regular operations. Don't be happy too early. The eye has noticed where the newly created APP is, why can't I find it? Yes, because no startup Item information is configured yet

On the ADT page, package Resource Manager page, right-click the project you have created and choose Properties> Run/debug settings. On the current page, click Create and select Android Application, enter the window for running configuration

Android: project: browse the current project and click Run. Wait a moment. The Android simulator window is displayed. After unlocking, you can see your first Android APP.

TIPS: you must feel that you are not addicted. Yes, Android also provides other methods, such as debugging on a real machine. If you use a real machine for configuration debugging on an android program, let's look down.

4. Configure the debugging process for a real machine

Preparations: first, you need an Android phone,


On the ADK page, choose "run"> "Run configuration"> "Run configuration"> "Target" from the shortcut menu. Select "Always prompt to pick device ".

Click "run" to bring up the Chooser interface for Android Device. In the list displayed in the check box, click "real machine configuration" and click "OK, check your mobile phone. An Android APP is installed by default on your mobile phone, that is, your Android APP, Hello Word!

5. If you see this step, you can create your own APP. But don't worry. It's just getting started. It's not going to be continued yet. Please follow this link.

If you like me, follow me and become a blog master. Haha

Original post

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.