【Android入门】-【AndroidManifest.xml】-【中英对照】

The AndroidManifest.xml File

安卓应用清单

该文高度总结,初学需要多次返回阅读体味

【来源: http://developer.android.com/guide/topics/manifest/manifest-intro.html】

Every application must have an AndroidManifest.xml file (with precisely that name) in its root directory. The manifest presents essential information about the application to the Android system, information the system must have before it can run any of the application's code. Among other things, the manifest does the following:

每个安卓应用必须有一个 AndroidManifest.xml 文件,该文件位于开发目录的主目录中,这里的 AndroidManifest.xml 就是开发目录中清单的真实文件名。AndroidManifest.xml 文件包含了运行在安卓系统上的应用所必须的信息,下面是AndroidManifest.xml 文件的作用:

  • It names the Java package for the application. The package name serves as a unique identifier for the application.

  • 让开发者在里面指定应用的Java包名称,这个包名称将作为应用的唯一标识。

  • It describes the components of the application — the activities, services, broadcast receivers, and content providers that the application is composed of. It names the classes that implement each of the components and publishes their capabilities (for example, which Intent messages they can handle). These declarations let the Android system know what the components are and under what conditions they can be launched.

  • 它描述了应用由哪几个组件,如活动、服务、广播接受者、内容提供者,描述了实现这些组件的Java类,并列出他们的功能,比如说明他们可以处理哪个 Intent 信息。以上这些声明就使安卓系统能够知道需要处理哪些东西,以及在什么条件下处理。

  • It determines which processes will host application components.

  • 高级AndroidManifest.xml 文件允许我们决定应用或其中的组件需要跑在哪些进程中。 】

  • It declares which permissions the application must have in order to access protected parts of the API and interact with other applications.

  • AndroidManifest.xml 文件允许我设置权限信息,表明我们的应用可以访问哪些受保护的API,以及能够同哪些其他应用交互,如内存管理软件可以设置权限来访问手机的系统信息。

  • It also declares the permissions that others are required to have in order to interact with the application's components.

  • AndroidManifest.xml 文件中权限的声明是相互的,也就是说也可以允许其他应用在需要时访问自己。

  • It lists the Instrumentation classes that provide profiling and other information as the application is running. These declarations are present in the manifest only while the application is being developed and tested; they're removed before the application is published.

  •  高级 AndroidManifest.xml 文件允许开发者使用Instrumentation 类(监测类)获得应用运行的信息,一般是开发或测试阶段使用,发布时将会被去掉。 】

  • It declares the minimum level of the Android API that the application requires.

  • AndroidManifest.xml 文件会在创建时自动判断并声明应用需要的最低安卓API版本。 】

  • It lists the libraries that the application must be linked against.

  • 【   【 高级】 AndroidManifest.xml 文件会列出应用需要链接的外部库。 】

你可能感兴趣的:(xml,android,Manifest)