Office Hours — Today, April 18

Tuesday, April 16

Apr 18
7:20 PM
Mark M.
has entered the room
7:25 PM
Mark M.
turned on guest access
7:30 PM
Eric
has entered the room
Eric
hey mark
Mark M.
hello, Eric!
how can I help you today?
7:35 PM
Mark M.
so... do you have a question?
Eric
yes hold on
7:40 PM
Eric
I created 2 product flavors, "orig" and "newFeature". newFeature can do additional things. I created a new folder by going to project view and right clicking to create new dir src/newFeature. I added the java files affected for newFeature. The java files contain all the code in the orig flavor + new methods, etc. The resources in the newFeature flavor only contain the additional dimensions and colors. When I attempt to build the debugnewFeature I get an error that it doesn't recognize the package name com.myapp.debugSuffix.newFeature
Mark M.
can you post the relevant portion of the build output?
or, if this message is not a compile error, where is this message appearing?
7:45 PM
Eric
View paste
"No matching client found for package name 'com.myapp.newFeatureSuffix,debugSuffix".  My app's gradle has:
productFlavors {
  newFeature {
    applicationIdSuffix ".newFeatureSuffix"
    versionNameSuffix "-newFeatureVersionNameSuffix"
  }
  orig
}

buildTypes {
  debug {
    applicationIdSuffix ".debug"
    versionNameSuffix "$version"
  release
}
it's a build error appearing in Build
Mark M.
is the comma in com.myapp.newFeatureSuffix,debugSuffix a typo in what you posted here?
Eric
yes it is. Here is the detailed error sorry: Execution failed for task ':app:processNewFetureDebugGoogleServices'
Mark M.
Eric
yep saw that last night
here's the kicker
7:50 PM
Mark M.
I don't use the Play Services plugin, mostly because I don't use Play Services very much, but it appears that you need dedicated google-services.json files per flavor, or perhaps per build variant
Eric
in my payments google-services.json the package_name is "com.myapp.newFeature". However I have a debug build type with applicationIdSuffix "debugSuffix". The former works for a release build type while the latter works for a debug build type. How do I change this file if I have a debug and release
Mark M.
you could try having dedicated google-services.json files per build variant, with the applicationId for that build variant in them
so, you would have a newFeatureDebug/google-services.json file that has the full package name for that build variant in it
and so on for any other build variant you want to build
7:55 PM
Eric
debug is a buildType that is a sibling directory to newFeature which is a productFlavor. are you suggesting making another debug directory inside newFeature with the json file
Mark M.
no, I am suggesting making a src/newFeatureDebug/ directory, as a peer of src/debug/ and src/newFeature/
src/debug/ is a source set for all debug builds
src/newFeature/ is a source set for all newFeature builds
src/newFeatureDebug/ is a source set for newFeature debug builds
Eric
where does src/main fit
Mark M.
that is alongside the others, and it contains the code to use for all builds
Eric
so would I create src/newFeatureRelease also?
Mark M.
if you plan on building it, presumably yes
Eric
ok I'll give that a shot thanks
Mark M.
basically, my interpretation of what I'm reading is that you need a google-services.json file that contains the applicationId of the build that you're building
Eric
yes
Mark M.
some people only put suffixes on either the flavor or the build type, in which case they would only need customized google-services.json files for the flavor or build type
Eric
but i was confused since I had src/debug, src/release, src/newFeature
Mark M.
you're using both suffixes, so I think you'll need JSON files per build variant
Eric
hmm how would you differentiate between them then
Mark M.
they are each in a separate directory
src/newFeatureDebug/google-services.json
src/newFeatureRelease/google-services.json
src/origDebug/google-services.json
8:00 PM
Mark M.
src/origRelease/google-services.json
and others if you add more build types or more product flavors
Eric
thanks, i was referring to why people wouldnt put suffixes for both buildtype and product flavor.
Mark M.
oh, sorry
Eric
np
Mark M.
for build types, you only need suffixes if you plan on running both types of builds on the same device or emulator
for a solo developer, you might do that
but for a larger project with a development team plus dedicated QA staff and stuff, developers might only ever run debug builds normally
in which case you might not need to add a suffix for the build type
plus, not everybody uses product flavors
8:05 PM
Eric
dang it didnt work
Mark M.
same error?
also, I think you need to configure matching stuff in your Play Developer Console or some such
looks like you can do this with one JSON file containing all the configurations, but the Firebase Console needs matching data
Eric
cool thanks I'll check it out. That's all for now!
Mark M.
sorry I didn't have a quick-and-easy solution!
Eric
it's hard to do so without looking at the code :)
Mark M.
that, and Firebase isn't my jam
(strawberry is my jam)
Eric
thank you, this was helpful though
8:10 PM
Eric
oh sorry one last thing. if the only difference between the newFeaturedebug and newFeaturerelease build variants is google-services.json, could I have a src/newFeature folder with code common to both variants, and just put the sole file in src/newFeaturedebug and src/newFeaturerelease?
8:15 PM
Mark M.
yes
Eric
awesome
goodnight
Mark M.
though, as that blog post indicates, you may not need per-build-variant JSON files -- you may be able to configure all the build variants in one JSON file
Eric
has left the room
Eric
has entered the room
Eric
doh sorry left too soon, what
Mark M.
though, as that blog post indicates, you may not need per-build-variant JSON files -- you may be able to configure all the build variants in one JSON file
Eric
ok ill need to read it
will try
goodnight
Mark M.
have a pleasant evening!
Eric
has left the room
8:25 PM
Mark M.
turned off guest access

Tuesday, April 16

 

Office Hours

People in this transcript

  • Eric
  • Mark Murphy