Perhaps due to the fact that some Google Play Services libraries still need to be included in your flavor without using firebase, some firebase related entries fall into the final merged AndroidManifest.xml.
So, if in addition to removing the gradle tasks that were added by the Google Services plugin (as described in Junyue Cao's answer), you want to remove the recipient, service, provider, use-use or other use of Firebase tags from the final unified AndroidManifest, you can add node markers in AndroidManifest.xml located in the application, create a configuration or create a subdirectory option.
If the node tokens are set to βdeleteβ, then the corresponding final AndroidManifest.xml will not contain the corresponding receiver tags, services, provider, use-permission tags.
For example, here is what you could add to AndroidManifest.xml in a hypothetical design source for the flavor source 'nofirebase' (app / src / nofirebase /):
<receiver android:name="com.google.firebase.iid.FirebaseInstanceIdInternalReceiver" tools:node="remove" /> <receiver android:name="com.google.android.gms.measurement.AppMeasurementReceiver" tools:node="remove" /> <receiver android:name="com.google.android.gms.measurement.AppMeasurementInstallReferrerReceiver" tools:node="remove" /> <receiver android:name="com.google.firebase.iid.FirebaseInstanceIdReceiver" tools:node="remove" > </receiver> <service android:name="com.google.android.gms.measurement.AppMeasurementService" tools:node="remove" /> <service android:name="com.google.firebase.iid.FirebaseInstanceIdService" tools:node="remove"/> <provider android:name="com.google.firebase.provider.FirebaseInitProvider" android:authorities="com.you.yourapp.firebaseinitprovider" tools:node="remove"/>
source share