中南财经政法大学 程序开发实践 课程报告
浅析安卓应用程序开发技术
组 长 组 员
*** (*********) ** (********) ** (********) ** (********)
专 业 指导教师
信息管理与信息系统(2010级) *** 2012年6月
完成日期
1
目 录
前言 ······································································································ 3 1 简介 ··································································································· 3
1.1 技术原理 ····················································································· 4 1.2 开发平台简介 ··············································································· 4 2 开发流程 ····························································································· 5
2.1 技术准备 ···················································································· 5 2.2 开发步骤 ···················································································· 5 2.3 部分代码分析 ·············································································· 9 3 问题及分析 ························································································· 14 3.1 技术优势 ···················································································· 14 3.2 系统漏洞 ···················································································· 15 3.3 优化发展 ···················································································· 15 4 项目组成员分工情况 ············································································· 1
2
前言
Android是以Linux为核心的手机操作平台,作为一款开放式的操作系统,随着Android的快速发展,如今已允许开发者使用多种编程语言来开发Android应用程序,而不再是以前只能使用Java开发Android应用程序的单一局面,因而受到众多开发者的欢迎,成为真正意义上的开放式操作系统。Android作为目前最流行的手机操作系统,关于其应用开发技术已经成了人们主要感兴趣的技术之一,此次我们浅析一下其开发的主要流程技术,便于参考学习,同时加强人们对于Android系统的理解。
本篇论文主要介绍一下该开发技术的工作步骤,以及部分参考代码的分析,目的在于更好地理解其技术实现。简要说明其在不同平台上的实现,并分析在目前的Android市场中出现的系统和技术方面的不足,以及优化设想。
1、 简介
1.1 技术原理
Android系统架构由5部分组成,分别是:Linux Kernel、Android Runtime、Libraries、Application Framework、Applications。 Linux Kernel
Android基于Linux 2.6提供核心系统服务,例如:安全、内存管理、进程
管理、网络堆栈、驱动模型。Linux Kernel也作为硬件和软件之间的抽象层,它隐藏具体硬件细节而为上层提供统一的服务。 如果你学过计算机网络知道OSI/RM,就会知道分层的好处就是使用下层提供的服务而为上层提供统一的服务,屏蔽本层及以下层的差异,当本层及以下层发生了变化不会影响到上层。也就是说各层各尽其职,各层提供固定的SAP(Service Access Point),专业点可以说是高内聚、低耦合。 如果你只是做应用开发,就不需要深入了解Linux Kernel层。 Android Runtime
Android包含一个核心库的集合,提供大部分在Java编程语言核心类库中
可用的功能。每一个Android应用程序是Dalvik虚拟机中的实例,运行在他们自己的进程中。Dalvik虚拟机设计成,在一个设备可以高效地运行多个虚拟机。Dalvik虚拟机可执行文件格式是.dex,dex格式是专为Dalvik设计的一种压缩格式,适合内存和处理器速度有限的系统。 大多数虚拟机包括JVM都是基于栈的,而Dalvik虚拟机则是基于寄存器的。两种架构各有优劣,一般而言,基于栈的机器需要更多指令,而基于寄存器的机器指令更大。dx 是一套工具,可以将 Java .class 转换成 .dex 格式。一个dex文件通常会有多个.class。由于dex有时必须进行最佳化,会使文件大小增加1-4倍,以ODEX结尾。 Dalvik虚拟机依赖于Linux 内核提供基本功能,如线程和底层内存管理。 Libraries
3