[英]What's the final package name of an activty after gradle merges manifests in a app+library project?
I have a project that is formed by a project and a library project. 我有一个由项目和图书馆项目组成的项目。 Both of them have their own manifest.
他们两个都有自己的清单。
The library project has all the acitivities definitions (and practically all the code). 库项目具有所有活动定义(以及几乎所有代码)。 The app project has a manifest where only an Application class is defined.
该应用程序项目有一个清单,其中仅定义了Application类。 (If you ask why i have this structure is because i have a common library and i create multiple app projects to change themes and api calls)
(如果您问为什么我有这种结构是因为我有一个公共库,并且我创建了多个应用程序项目来更改主题和api调用)
My question is, when i have to define my initial activity class name in platforms, ie Facebook, should i use my library project package name as it is defined in its manifest? 我的问题是,当我必须在平台(例如Facebook)中定义初始活动类名称时,是否应该使用清单文件中定义的图书馆项目软件包名称? or gradle merges it with my app project package name?
或gradle将其与我的应用程序项目包名称合并?
Example: 例:
com.app.finalproject is my application package name. com.app.finalproject是我的应用程序包名称。
com.commonlibrary.ui.SplashActivity is my common package name of my initial activity and it is defined in my common library project manifest. com.commonlibrary.ui.SplashActivity是我的初始活动的常用包名称,它是在我的公共库项目清单中定义的。
So, after gradle merges the two manifest what is the package name of my SplashActivity ? 因此,在gradle合并两个清单之后,我的SplashActivity的软件包名称是什么? is it still com.commonlibrary.ui.SplashActivity o is it something like com.app.finalproject.ui.SplashActivity ?
还是com.commonlibrary.ui.SplashActivity还是com.app.finalproject.ui.SplashActivity之类的东西?
Thanks in advance. 提前致谢。
Activities do not have a package name, strictly speaking. 严格来讲,活动没有包名称。
The Java class that implements an activity will be in a Java package. 实现活动的Java类将在Java包中。 That package is denoted by the
package
line at the top of the class file, along with the directory in which the Java class resides. 该包由类文件顶部的
package
行以及Java类所在的目录表示。 None of that is affected by the manifest merger process. 这些都不受清单合并过程的影响。
Sometimes, you need a full ComponentName
of an activity or other component. 有时,您需要活动或其他组件的完整
ComponentName
。 In that case, the package portion of the ComponentName
will be the application ID. 在这种情况下,
ComponentName
的包部分将是应用程序ID。 The Java class portion of the ComponentName
will still use its regular Java package. ComponentName
的Java类部分仍将使用其常规Java包。
Using your example, if I am understanding it correctly, the activity is still com.commonlibrary.ui.SplashActivity
. 使用您的示例,如果我正确理解它,则该活动仍然是
com.commonlibrary.ui.SplashActivity
。 The ComponentName
for that activity would be com.app.finalproject/com.commonlibrary.ui.SplashActivity
. 该活动的
ComponentName
为com.app.finalproject/com.commonlibrary.ui.SplashActivity
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.