简体   繁体   中英

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. (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)

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? or gradle merges it with my app project package name?

Example:

com.app.finalproject is my application package name.

com.commonlibrary.ui.SplashActivity is my common package name of my initial activity and it is defined in my common library project manifest.

So, after gradle merges the two manifest what is the package name of my SplashActivity ? is it still com.commonlibrary.ui.SplashActivity o is it something like 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. 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. None of that is affected by the manifest merger process.

Sometimes, you need a full ComponentName of an activity or other component. In that case, the package portion of the ComponentName will be the application ID. The Java class portion of the ComponentName will still use its regular Java package.

Using your example, if I am understanding it correctly, the activity is still com.commonlibrary.ui.SplashActivity . The ComponentName for that activity would be com.app.finalproject/com.commonlibrary.ui.SplashActivity .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM