Reputation: 101
I have a project setup with 4 modules that flows like this Module1 -> Module2 -> Module3 Module4
Module1 and Module4 are both entry points in to the app and need to have their own launch icons
Before I split the app in to modules this worked fine but when I split this into modules Modules 1 and 4 are are treated independent and I can either launch one or the other.
This is fine while developing the app but what I want at the end is to generate one APK that contains all modules and create 2 launcher icons when installed, but this isn't happening because it seems to generate 2 APKs
How do I need to organise this to generate one APK?
Upvotes: 4
Views: 1112
Reputation: 101
I figured it out.
It needs a bit more than just setting the intent filter so I thought I would explain it here in case anyone else is trying this.
Module1 is the application module, Module4 needs to be a library with just the bare definition for an activity.
Then in Module1 manifest you need to create an activity alias to Module4
The process is decribed well here..
http://blog.danlew.net/2014/01/16/preserve-your-launchers-use-activity-alias/
Also because of this Module1 now has a dependency on Module4 too
Upvotes: 2
Reputation: 4087
In your Manifest file write this code at both entry point . it will generate two instance . for ex like this
<activity
android:name=".Activity.Your_module1_entry_activity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
and for your second module
<activity
android:name=".Activity.your_module2_entry_activity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Upvotes: 1