以HelloWorld程序的AndroidManifest.xml文件为例:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <!-- 程序清单文件 包含程序组件结构和元数据 xml nampspace 命名空间的引用 -->package="czm.android.hello" <!-- 所在的包名称 -->
android:versionCode="1" <!-- 应用版本代码 -->
android:versionName="1.0" > <!-- 应用版本号码 -->
<uses-sdk android:minSdkVersion="8" /> <!-- 声明开发使用的SDK最低版本号 -->
<application
android:icon="@drawable/ic_launcher" <!-- 这是应用程序的启动图标 @访问R.java文件中对照查看 -->
android:label="@string/app_name" > <!-- 这是应用的标题 @访问string.xml文件中的app_name这个名称 -->
<activity
android:label="@string/app_name" <!-- 首先注意这是在Activity类似于组件的东西中,表示应用程序名称 这个标签名如果不存在则启用label中定义的app_name-->
android:name=".HelloWorldActivity" > <!-- 这个Activity类的名称是HelloWorldActivity 必须在类文件当前包内,这个.HelloWorldActivity前的.才可以省去 -->
<intent-filter > <!-- 意图过滤 主要表示你要干什么 -->
<action android:name="android.intent.action.MAIN" /> <!-- 这个动作Action的名称 入口类-->
<category android:name="android.intent.category.LAUNCHER" /> <!-- 加了这个类别 启动器 应用程序会出现在屏幕上 -->
</intent-filter>
</activity>
</application>
</manifest>
模拟器启动成功消息:
[2012-05-04 11:33:45 - HelloWorld] ------------------------------
[2012-05-04 11:33:45 - HelloWorld] Android Launch!
[2012-05-04 11:33:45 - HelloWorld] adb is running normally.
[2012-05-04 11:33:45 - HelloWorld] Performing czm.android.hello.HelloWorldActivity activity launch
[2012-05-04 11:33:45 - HelloWorld] Automatic Target Mode: using existing emulator 'emulator-5554' running compatible AVD 'Baby'
[2012-05-04 11:33:47 - HelloWorld] Application already deployed. No need to reinstall.
[2012-05-04 11:33:47 - HelloWorld] Starting activity czm.android.hello.HelloWorldActivity on device emulator-5554
[2012-05-04 11:33:50 - HelloWorld] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=czm.android.hello/.HelloWorldActivity }
活动管理器会负责处理传送过来的意图,而意图则包含Action和Category文件。