Issue
My Android gradle currently set a flavor dimension for using different push service. (One for baidu push and one for GCM) I would like to have my Android app only to import google-services
for a GCM push build flavor. Is it possible to do it?
P.S. Because in order to use GCM in Android, I have to add the apply plugin: 'com.google.gms.google-services'
line be at the bottom of my app/build.gradle file as detailed here.
As a workaround in order to let the baidu flavor to be built successfully, I may need to place a dummy google-services.json
for baidu.
Update: I seem to find the answer in this long github issue thread.
Solution
In your build.gradle
(App)file add this code:
if (getGradle().getStartParameter().getTaskRequests()
.toString().contains("YourGCMFlavorName")){
apply plugin: 'com.google.gms.google-services'
}
N.B.: First letter of flavor name must be in Uppercase
Answered By - Anisuzzaman Babla
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.