简体   繁体   English

gradle合并应用程序+库项目中的清单后,该活动的最终包名称是什么?

[英]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 . 该活动的ComponentNamecom.app.finalproject/com.commonlibrary.ui.SplashActivity

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 统一项目作为库和android项目后,清单中出现错误 - Error occurs in manifests after the unity project as library and android project Android共享库项目清单 - Android Shared Library Project Manifests 端点库生成后,App Engine连接的android项目中的包名称错误 - Package name error in app engine connected android project after endpoint library generation Gradle依赖项:编译项目和编译名称有什么区别? - Gradle dependencies: What's the difference between compile project and compile name? 使用我的应用和库清单之间出错 - Error between manifests with my app and library 如果不在Gradle的项目结构中,如何引用库? - How to reference to library if it's not in project structure in Gradle? 错误:Gradle 任务 assembleDebug 失败,退出代码为 1 - 在 flutter 项目中更改包名称后 - Error: Gradle task assembleDebug failed with exit code 1 - after change package name in flutter project 巴克 - 构建具有多种Gradle风格/构建类型和清单的Android应用程序 - Buck - building android app with multiple Gradle flavors/build types and manifests 在单个应用程序中为不同清单创建Gradle样式时遇到麻烦 - Having trouble creating Gradle flavors for different manifests in a single app package 名称是 android 是什么应用程序? - What the App is it that package name is android?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM