Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: No flavor is associated with flavor dimension 'xxx'

I have the following in my application-level build.gradle file:

flavorDimensions "store", "features"

productFlavors {
    amazon {
        dimension "store"
        ...
    }
    play {
        dimension "store"
        ...
    }
    none {
        dimension "features"
        ...
    }
    myAwesomeFeature {
        dimension "features"
        ...
    }
    anotherAwesomeFeature {
        dimension "features"
        ...
    }
    all {
        dimension "features"
        ...
    }
}

I get an error when I try to sync my project files saying "Error: No flavor is associated with flavor dimension 'store'." I was previously using flavorDimension in the productFlavors but there were compiler warnings that it was deprecated for "dimension"... with either (or both) it throws the error.

I clearly have 2 flavors with dimension store. I've looked through docs and sample code and can't find out what's wrong. I tried updating my gradle plugin from 1.2.0 through 1.2.3 and I've tried upgrading my version of gradle from 2.2.1 to 2.4.

What am I doing wrong? I tried copying the example from here and it gives a similar error. This article was pretty worthless.

like image 213
Dewey Vozel Avatar asked May 13 '15 17:05

Dewey Vozel


1 Answers

The problem was that for some reason the build system does not like either "none" or "all" (not sure which, because I changed them both) as a product flavor. I changed them to noFeatures and allFeatures and it worked fine.

It's fine if there are reserved words... it would be awesome if they were prevalent in the documentation. AFAIK, all and none aren't reserved words in Java or Groovy.

It would have also been awesome if the error message was more meaningful.

like image 71
Dewey Vozel Avatar answered Nov 15 '22 07:11

Dewey Vozel