在Manifest文件中Application以及各个组件均可以设置,其含义如下:
1,Application
Google SDK docs说明:
<span style="font-family:Microsoft YaHei;font-size:14px;">The name of a process where all components of the application should run. Each component can override this default by setting its own process attribute.
By default, Android creates a process for an application when the first of its components needs to run. All components then run in that process. The name of the default process matches the package name set by the <manifest> element.
By setting this attribute to a process name that's shared with another application, you can arrange for components of both applications to run in the same process — but only if the two applications also share a user ID and be signed with the same certificate.
If the name assigned to this attribute begins with a colon (':'), a new process, private to the application, is created when it's needed. If the process name begins with a lowercase character, a global process of that name is created. A global process can be shared with other applications, reducing resource usage.</span>
意思是:应用程序的进程名,所有组件默认情况下均运行在这个进程中,其默认名字为PackageName。可以设置两个APP运行在同个process下,当且仅当两个APP具有想通的user ID并且被同一个私钥签名。若名字以":"开头,意味着APP在运行时可以在必要的时候新建一个process。
2,Activity、Service
Google SDK docs说明:
<span style="font-family:Microsoft YaHei;font-size:14px;">The name of the process in which the activity should run. Normally, all components of an application run in a default process name created for the application and you do not need to use this attribute. But if necessary, you can override the default process name with this attribute, allowing you to spread your app components across multiple processes.
If the name assigned to this attribute begins with a colon (':'), a new process, private to the application, is created when it's needed and the activity runs in that process. If the process name begins with a lowercase character, the activity will run in a global process of that name, provided that it has permission to do so. This allows components in different applications to share a process, reducing resource usage.
The <application> element's process attribute can set a different default process name for all components.</span>
意思是:为这个Activity、Service单独创建一个进程。
总结:
1,可以设置android:process属性使APP的组件运行在不同的进程上;
2,可以设置android:process以使不同应用的组件们可以运行于同一个进程—假如这些应用共享同一个用户ID并且有相同的数字证书;