【错误记录】Gradle 配置 productFlavors 报错 ( All flavors must now belong to a named flavor dimension. )
生活随笔
收集整理的這篇文章主要介紹了
【错误记录】Gradle 配置 productFlavors 报错 ( All flavors must now belong to a named flavor dimension. )
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
文章目錄
- 一、報錯信息
- 二、解決方案
一、報錯信息
在 build.gradle 中配置 productFlavors 后報錯 ;
配置內容 :
// 定義不同的開發和產品風格productFlavors {// 開發風格dev {// 開發時使用 minSDKVersion = 21 允許 Android Gradle 插件// 為每個 Module 模塊產生一個 APK 安裝包 , 可以在 Android Lollipop 系統上進行測試// 無需進行耗時的 dex 合并過程minSdkVersion 21}// 產品風格prod {// 應用實際的最小 SDKminSdkVersion 14}}報錯內容 :
FAILURE: Build failed with an exception.* 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* Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.* Get more help at https://help.gradle.orgBUILD FAILED in 198ms二、解決方案
使用低版本的 Gradle 插件不會報錯 , 使用高版本的 Gradle 插件報錯 ;
在 build.gradle 中的 " android / defaultConfig " 層級下 , 配置 flavorDimensions 維度版本號 , 任意配置一個字符串作為值即可 ;
android {defaultConfig {// 維度版本號flavorDimensions "1.0"} }總結
以上是生活随笔為你收集整理的【错误记录】Gradle 配置 productFlavors 报错 ( All flavors must now belong to a named flavor dimension. )的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 杨辉三角 C语言实现【一维数组】
- 下一篇: 跟单信用证统一惯例