All flavors must now belong to a named flavor dimension

* What went wrong:
A problem occurred configuring project ':app'.
> All flavors must now belong to a named flavor dimension. Learn more at https://d.android.com/r/tools/flavorDimensions-missing-error-message.html

表示看了下https://d.android.com/r/tools/flavorDimensions-missing-error-message.html还是没弄懂应该怎么搞,
实际上我只需要根据不同apk生成不同的 BuildConfig.isvip字段,以前是通过包名,现在我想尝试创建字段,显然不行,所以我目前只能删除flavor节点了,有知道怎么搞的朋友欢迎反馈

各位实在想折腾的可以降级gradle,可以从官网看出来最新版做了一些跳转

连android studio自带的Flavors配置都出错,也是无语了,表示无法理解老外的语言

    productFlavors {
        flavor {
            minSdkVersion 14
            applicationId 'cn.qssq666.redpacket'
            versionName '1.5.8'
            versionNameSuffix 'pro'
        }
    }

最后发现我太浮躁了
https://stackoverflow.com/questions/44105127/android-studio-3-0-flavor-dimension-issue
找到了答案

Flavor 'productFlavors' has no flavor dimension.

因为多了一个flavor节点,导致他找不到dimension

    productFlavors {
        //  flavorDimensions 'default'
     
            isfree {
                dimension "free"
                buildConfigField "boolean", "ispay", "false"
            }
            ispaid {
                dimension "paid"
                 buildConfigField "boolean", "ispay", "true"
            }
       
   
    }

大家不要把dimension和那些分辨率像素挂钩,我当时没看懂也不敢实验就是被这个单词吓住了,因为我并不需要自定义像素,我不想粘贴代码尝试,哈哈知道看到另外的问题网站才恍然大悟了。。

你可能感兴趣的:(All flavors must now belong to a named flavor dimension)