lannyf
lannyf

Reputation: 11035

can each AndroidManifest in multiple modules project have it's own <application> part? how to share resource among the modules?

Having a androidStudio project which has multiple modules.

prj - apply plugin: 'com.android.application', (prj is also the testing application utilizing both modulA and moduleB)

Internally module A depends on module B.

And the modules are to be used as library in other different application projects. The other application project could have dependency on either module A, or module B.

In module A it has a few activities,

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.oath.module_a">

<application
    android:hardwareAccelerated="true"
    android:largeHeap="true">

    <activity
        android:name="com.module_a.LoginActivity"
        android:launchMode="singleTop"
        android:theme="@style/ModuleATheme" />

   ... ...

</application>

and in module B it has also a few activities.

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.oath.module_b">

<application
    android:hardwareAccelerated="true"
    android:largeHeap="true">

    <activity
        android:name="com.module_b.DetailsActivity"
        android:launchMode="singleTop"
        android:theme="@style/ModuleBTheme" />

   ... ...

</application>

is it ok to have <application> in the individual manifest of the module if the module has dependency on each other?

How to make the shared resources if they are used in both moduleA and moduleB?

Upvotes: 2

Views: 2238

Answers (1)

CommonsWare
CommonsWare

Reputation: 1007554

is it ok to have in the individual manifest of the module if the module has dependency on each other?

Yes. When the app is compiled, the manifests from the modules (and your libraries, and your app, and your build variants) all get merged together.

How to make the shared resources if they are used in both moduleA and moduleB?

Since moduleA depends upon moduleB, you should be able to put the shared resources in moduleB, and moduleA should be able to reference them.

Upvotes: 6

Related Questions