Error:All flavors must now belong to a named flavor dimension. Learn more at https://d.android.com/r

The error appeared on AndroidStudio3.0, and the original old project was opened on AS3.0 when the error was reported, which means that all flavors must be unified!
The solution is also very simple, just make some changes in the Module's build.gradle, as follows:
Change the previous code:

    productFlavors {
        erds {}
        yiqi {}
        productFlavors.all {
            flavor -> flavor.manifestPlaceholders = [REGION_VALUE: name]
        }
    }

Resolved code:

    flavorDimensions "default"
    productFlavors {
        erds {
            dimension "default"
        }
        yiqi {
            dimension "default"
        }
        productFlavors.all {
            flavor -> flavor.manifestPlaceholders = [REGION_VALUE: name]
        }
    }

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325502286&siteId=291194637