I have one flavor, and a main codebase. I can switch to the flavor and the project runs, and I can switch back to the main codebase and the project runs, but neither of these projects will display icons. I do not know why, my only assumption is that something is wrong with my declarations and attributes added to intent-filer
Flavor AndroidManifest.xml
<application
android:name="com.example.flavor.application.MyApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/CustomAppTheme"
tools:replace="android:name">
<!-- main launcher Activity -->
<activity
android:name="com.example.flavor.activity.RegistrationActivity"
android:configChanges="orientation|screenSize"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:theme="@style/CustomAppTheme"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="com.example.flavor.activity.RegistrationActivity"/>
<action android:name="android.intent.action.MAIN"/>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
</intent-filter>
</activity>
</application>
Main AndroidManifest.xml
<application
android:name="com.example.application.MyApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/CustomAppTheme"
tools:replace="android:name">
<!-- main launcher Activity -->
<activity
android:name="com.example.activity.RegistrationActivity"
android:configChanges="orientation|screenSize"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:theme="@style/CustomAppTheme"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="com.example.activity.RegistrationActivity"/>
<action android:name="android.intent.action.MAIN"/>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
</intent-filter>
</activity>
</application>
My build gradle is setup as the following
productFlavors {
standard {
applicationId 'com.example'
manifestPlaceholders = [package_name: "com.example", primary_lang: "en"]
signingConfig signingConfigs.keystore
}
legacyTest {
applicationId 'com.example.flavor.test'
manifestPlaceholders = [package_name: "com.example.flavor.test",
target : "Test", primary_lang: "en"]
signingConfig signingConfigs.keystore
}
}
The RegistrationActivity class is different for the Flavor and the main code base. There is no overriding going on, and I believe that since I am using a different package these are effectively acting as different classes which is what I want. But my question is, how come with the Manifest merger I cannot have separate app icons, my flavor icons and my main app icons? Nothing is being displayed. Thanks in advance
OK, so its the way I setup my intent filters. I had to separate them in the following structure
Flavor AndroidManifest.xml
<intent-filter>
android:name="com.example.flavor.activity.RegistrationActivity"
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
</intent-filter>
Main AndroidManifest.xml
<intent-filter>
android:name="com.example.activity.RegistrationActivity"
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
</intent-filter>
I do not understand the technical reasons why this format works, but grouping everything under one intent-filter will cause issues, such as error at runtime or no app icon. Cheers