I have two gradle
product flavors
: for prod and for stage server.
productFlavors {
stage {
// stage specific stuff
}
production {
// production only
}
}
Also I have an AppWidget must be able only for stage now. I think I should hide my AppWidgetProvider
in manifest:
<receiver
android:name=".appwidget.AppWidgetProvider"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/appwidget_info" />
</receiver>
But how can I do it just for prod product flavor? Or is there another way here?
So we will have our example packages is as follows for your production and staging builds within the gradle product flavors.
Here is an example of your folder structure some of which may or may not apply to your project but should give you a run down of what is needed.
Now to be clear your string result set xml in the production and staging, among the values -> string.xml, will have to contain the following value appropriate for the manifest which will be described below.
So something like as follows
With my current understanding of your manifest it would look something like this
So this would work, but if you saw from my third comment, a much better and simpler solution would be to have a different manifest for each build phase, because you may want more changes than just one. So below I will provide that work around as well which you can extrapolate on what I have provided.
Using source set in gradle you can specify a different build path for each manifest as follows