Android environment construction and first instance

Source: Internet
Author: User

I. Environment Construction
1. Download the android SDK and ADT
2. Open Eclipse, click Install New Software under Help, click add, and Install ADT through the pop-up interface. You can set the Name to the path where the Location is ADT (note: the path should not have a Chinese name), click OK after adding, and then click Next... Next... Complete
3. Install the required Virtual Machine: Click window, and then click AVD Manager. On the displayed page, click New,
Target selects the version (my version is 2.3.3)
The Built-in Skin selects the resolution.
Ii. Set the code prompt function for Eclipse for android
In the Eclipse for android editor, you need to implement the automatic prompts for two main types of files: java and xml code.
1. Automatic prompt in the java file:
Open Eclipse and choose Window> Preferences> Java> Editor-Content Assist> Auto activation triggers for Java. The default setting box is a vertex. Change it to. abcdefghijklmnopqrstuvwxyz (,
2. Automatic prompt in xml code:
In Eclipse, choose Window> Preferences> Xml> Editor> Content Assist> Auto activation> Prompt when these characters are inserted. The default value is <= :, change it to <= :. abcdefghijklmnopqrstuvwxyz (,
Iii. First Instance
Create an android Project
Right-click the mouse --> new --> other... --> Android Project --> next --> name the Project --> next --> select a version (I chose 2.3.3) --> next --> the package name must be at least level 2 --> click finish.
When you create a project, the tool automatically generates a lot of code, such:
R. java file, which belongs to an internal file and cannot be modified
You can modify the name and content of an application in the string. xml file of values under res:
<? Xml version = "1.0" encoding = "UTF-8"?>
<Resources>
<String name = "hello"> I am the first application content </string>
<String name = "app_name"> first application </string>
</Resources>
The file AndroidManifest. xml is very important. The following describes some configurations in this file.
<? Xml version = "1.0" encoding = "UTF-8"?>
<Manifest xmlns: android = "http://schemas.android.com/apk/res/android"
Package = "cn. csdn. hr. android"
Android: versionCode = "1"
Android: versionName = "1.0" type = "codeph" text = "/codeph">
<! -Manifest is the root tag. android is the namespace package name. -->
<! -- Android version -->
<Uses-sdk android: minSdkVersion = "10"/>
<! -- Application: An application can contain multiple activities.
Icon: the icon of the app.
@ Refers to the reference label: label name -->
<Application
Android: icon = "@ drawable/ic_launcher"
Android: label = "@ string/app_name">
<! -- Equivalent to bean in spring, which is equivalent to action in struts2
Name is the class name label is the label name -->
<Activity
Android: label = "@ string/app_name"
Android: name = ". Lession01Activity">
<! -- Intent filter -->
<Intent-filter>
<! -- Action indicates action
Android. intent. action. MAIN program entry
-->
<Action android: name = "android. intent. action. MAIN"/>
<! -- Category indicates the category and category of an action. What is this action?
Android. intent. category. LAUNCHER: starts when the application is started.
-->
<Category android: name = "android. intent. category. LAUNCHER"/>
</Intent-filter>
</Activity>
</Application>
</Manifest>
Right-click the project name and choose start from the shortcut menu. The name and content are displayed on the mobile phone.
Note:
1. android is slow to start, so do not enable or disable it frequently, which will be a waste of time. However, enabling android requires a relatively large amount of memory. Therefore, you must ensure that the drive C has sufficient space. The longer the drive time, the more memory occupied. Therefore, you cannot open the drive all day.
2. How to view the startup information on the console
Android startup is different from general java project startup information, which is displayed on the Console and android startup information in LogCat. The following describes how to put LogCat on the console:
Window --> show View --> other --> Find LogCat In the Android folder and click OK.

 

 

Author w_l_j

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.