Reputation: 18725
When trying to build a Play Services enabled project with multiple flavors, I get compile errors. I think this might be related to my package names not matching, but I am not sure. Anybody have any hints about what I am doing wrong?
I am using the newer gradle plugin that allows this (per this GH issue)
I am seeing an error when I try to build multiple flavors:
Error:(115, 50) error: cannot find symbol variable global_tracker
I double checked the package names match my expectation, but wonder if I still am not correct.
My build.gradle looks like this:
productFlavors {
app1 {
applicationId "com.examplea.app"
manifestPlaceholders = [domain:"examplea"]
}
imore {
applicationId "com.exampleb.app"
manifestPlaceholders = [domain:"exampleb"]
}
crackberry {
applicationId "com.examplec.app"
manifestPlaceholders = [domain:"examplec"]
}
an example of one of my google-services.json files (which is located at main/src/examplea) is:
{
"project_info": {
"project_id": "",
"project_number": "",
"name": ""
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:10908349452:android:bb075abfhadshfjd",
"client_id": "android:com.examplea.app",
"client_type": 1,
"android_client_info": {
"package_name": "com.examplea.app"
}
},
"oauth_client": [],
"api_key": [],
"services": {
"analytics_service": {
"status": 1
},
"cloud_messaging_service": {
"status": 1,
"apns_config": []
},
"appinvite_service": {
"status": 1,
"other_platform_oauth_client": []
},
"google_signin_service": {
"status": 1
},
"ads_service": {
"status": 1
}
}
}
]
}
Upvotes: 1
Views: 207
Reputation: 18725
I figured out my issue, it was that certain flavors didn't have Google Analytics Config info, so apparently the plugin wasn't generating the config files for just that variant.
I double checked each of the flavor's google-services.json files, and realized some of them had analytics info (like this):
"analytics_service": {
"status": 2,
"analytics_property": {
"tracking_id": "UA-10XXXXX6-1"
}
},
while others had this (which was incorrect):
"analytics_service": {
"status": 1
}
I made sure both were consistent (and had Analytics config info), and this resolved my build issues.
Upvotes: 3