NS 4.1 and flavors: All flavors must now belong to a named flavor dimension


Short version: how are flavors used in {N} 4.1?

OK, maybe I should have known better, but…

I successfully upgraded my app to NS 4.1 (with some effort - see this issue). I was getting build warnings about Node, so I updated Node and NPM to the latest versions. Then I thought I’d start using WebPack. That pulled in all kinds of packages and side dependencies, but yielded non-working code. So, I decided I’d tackle WebPack later and reverted to an earlier commit. And that gets me to:

Now when I compile, I receive various build errors all starting with,

All flavors must now belong to a named flavor dimension.

I know that NS 4.1 added support for flavors, and I’ve found Android docs for specifying flavors, but what I don’t know is what that means in an PAN (Plain Awesome NativeScript) context. In particular, what changes do I need to make to accommodate favors on Android in {N} 4.1? I’d welcome any pointers.

As a side note, I created a new project and it compiled successfully on Android. For what’s worth, here the complete app.gradle fie:

// Add your native dependencies here:

// Uncomment to add recyclerview-v7 dependency
//dependencies {
//	compile 'com.android.support:recyclerview-v7:+'

android {  
  defaultConfig {  
    generatedDensities = []
    applicationId = "tech.govia.rrr" 
    //override supported platforms
    // ndk {
    //       abiFilters.clear()
    //   		abiFilters "armeabi-v7a"
 		// }
  aaptOptions {  
    additionalParameters "--no-version-vectors"  

  // See https://github.com/NativeScript/nativescript-geolocation/issues/108
  // See also https://github.com/NativeScript/nativescript-geolocation/issues/81
  project.ext {
    googlePlayServicesVersion = "11.2.+"
    // googlePlayServicesVersion = "12.0.1"
    // supportVersion = "26.0.0"
    // googlePlayServicesVersion = "+"

dependencies {
    compile 'com.google.maps.android:android-maps-utils:0.5+'

def settingsGradlePath = "$rootDir/../../app/App_Resources/Android/settings.gradle";
def settingsGradleFile = new File(settingsGradlePath);
    apply from: settingsGradleFile;


Hi !
Did you find a solution ?


@TheOnlyMatt - no, not yet. I plan to focus on this over the next few days, though, and will report my results here.


It’s been a week or so since I’ve been able to get back to this… Now, I’m able to compile and run successfully on Android even without any additions to app.gradle. I’m not sure what changed, but at least it’s working.

Feeling flushed with success, I upgraded from {N} 4.1.0 to 4.1.1, and it still works (after I modified build.gradle for the nativescript-google-maps-sdk plugin, see this issue).

So, fo the moment, I’ll assume that all’s well that ends well, and I’ll just hope this particular problem has ended.