Android开发笔记3----Android Dalvik,包和文件介绍

一. Dalvik
    Dalvik 基于寄存器,而Java虚拟机(JVM)基于栈。基于寄存器的虚拟机对于更大的程序来说,在它们编译的时候,花费的时间更短。
    Dalvik 经过优化,允许在有限的内存中同时运行多个虚拟机的实例,并且每一个Dalvik 应用作为一个独立的Linux 进程执行。独立的进程可以防止在虚拟机崩溃的时候所有程序都被关闭.

二. Java包
     在Android 的应用程序开发中,通常使用的是JAVA语言,除了需要熟悉JAVA 语
言的基础知识之外,还需要了解Android 提供的扩展的JAVA功能。
    在一般的JAVA 应用中,如果需用引用基础类库,通常需要使用如下的方式:
               import javax.swing.*;
    以上代码表示了引用JAVA 的GUI组件Swing,javax.swing 即JAVA 中的一个包。
android 提供一些扩展的JAVA 类库,类库分为若干个包,每个包中包含若干个类。




三. Android的相关文件类型
 (1)Java文件-----应用程序源文件
     android 本身相当一部分都是用java 编写而成,android 的应用必须使用java 来开发。
 (2)Class文件------Java编译后的目标文件
     不像J2se,java 编译成class 就可以直接运行,android 平台上class 文件不能直接在android 上运行。由于Google使用了自己的Dalvik 来运行应用,所以这里的class 也肯定不能在AndroidDalvik 的java 环境中运行,android的class 文件实际上只是编译过程中的中间目标文件需要链接成dex 文件后才能在dalvik 上运行
 (3)Dex文件-----Android平台上的可执行文件
     Android 虚拟机Dalvik 支持字节码文件格式。Google 在新发布的Android 平台上使用了自己的Dalvik 虚拟机来定义,这种虚拟机执行的并非Java 字节码,而是另一种字节码:dex格式的字节码。在编译Java代码之后,通过Android 平台上的工具可以将Java 字节码转换成Dex 字节码。这个DalvikVM 针对手机程式/CPU 做过最佳化,可以同时执行许多VM 而不会占用太多Resource。
 (4)Apk文件-------Android上的安装文件
     Apk 是Android 安装包的扩展名,一个Android 安装包包含了与某个Android 应用程序相关的所有文件。apk文件将AndroidManifest.xml 文件、应用程序代码(.dex文件)、资源文件和其他文件打成一个压缩包。一个工程只能打进一个.apk 文件。


Android虚拟机Dalvik完整源码,宝贵资源,欢迎下载! This directory contains the Dalvik virtual machine and core class library, as well as related tools, libraries, and tests. A note about the licenses and header comments --------------------------------------------- Much of the code under this directory originally came from the Apache Harmony project, and as such contains the standard Apache header comment. Some of the code was written originally for the Android project, and as such contains the standard Android header comment. Some files contain code from both projects. In these cases, the header comment is a combination of the other two, and the portions of the code from Harmony are identified as indicated in the comment. Here is the combined header comment: /* * Copyright (C) The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * ---------- * * Portions of the code surrounded by "// BEGIN Harmony code" and * "// END Harmony code" are copyrighted and licensed separately, as * follows: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ Native SH call bridge --------------------- Native SH call bridge is written by Shin-ichiro KAWASAKI and Contributed to Android by Hitachi, Ltd. and Renesas Solutions Corp.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值