What is manifest file in Android?

2019-04-04 14:28发布

Can anybody explain me in simple words what is the use of Manifest file and R.java file in android.

Why do we need these files while making an application?

4条回答
SAY GOODBYE
2楼-- · 2019-04-04 14:50

check this link,

http://developer.android.com/guide/topics/manifest/manifest-intro.html

Manifest

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

R.Java

It will have identifier for all resource used in our project

thank you.

查看更多
来,给爷笑一个
3楼-- · 2019-04-04 15:04

I think it is a good idea for you to read through the Android Hello World. Both AndroidManifest and R.java are explained.

查看更多
我欲成王,谁敢阻挡
4楼-- · 2019-04-04 15:08

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.

Check the following link

http://developer.android.com/guide/topics/manifest/manifest-intro.html

A project's R.java file is an index into all the resources defined in the file. You use this class in your source code as a sort of short-hand way to refer to resources you've included in your project. This is particularly powerful with the code-completion features of IDEs like Eclipse because it lets you quickly and interactively locate the specific reference you're looking for.

Check the following link

http://developer.android.com/resources/tutorials/hello-world.html

查看更多
家丑人穷心不美
5楼-- · 2019-04-04 15:13

Manifest file:

  1. It is a declaration file.
  2. Here only Which activity should start first, that has been declared.
  3. It declares which permissions the application must have.
  4. It also declares the permissions that others are required to have in order to interact.
  5. It declares the minimum level of the Android API.
  6. It lists the libraries that the application must be linked.
  7. All the component should declared here.
  8. The components are activities, services, broadcast receivers, and content providers.

R.java file:

  1. It is an auto-generated file by aapt (Android Asset Packaging Tool) that contains resource IDs for all the resources of res/ directory.
  2. If you create any component in the activity_main.xml file, id for the corresponding component is automatically created in this file.
  3. This id can be used in the activity source file to perform any action on the component.
查看更多
登录 后发表回答