gonzobrains
gonzobrains

Reputation: 8036

How to replace activity in Android library project's manifest with another

I have a child project that contains an activity within its manifest that I would like to use in place of one already defined in the manifest of a library project used by that child project. Is this possible? I thought about using Manifest Merger but can this work if the activities are named differently?

Is it possible to specify a marker that would be used to indicate the one to replace?

If not, can the replacement be done based on category instead?

Upvotes: 2

Views: 1814

Answers (1)

MatBos
MatBos

Reputation: 2390

You were correct about using Manifest Merger. In your projects AndroidManifest.xml file add following statements.

<application>
...
    <activity
          android:name="TheOneToRemove"
          tools:node="remove"/>
    <activity
          android:name="TheOneYouWantToAdd"
          />
...
</application>

This way you will exclude activity from the library and include yours. See this documentation for details.

Upvotes: 5

Related Questions