前言

最近写的项目越来越大,出现了64K问题,所以用了Multidex来突破64K方法数限制,然后为了优化编译速度在build.gradle文件中加入了如下代码

productFlavors {// Define separate dev and prod product flavors.dev {// dev utilizes minSDKVersion = 21 to allow the Android gradle plugin// to pre-dex each module and produce an APK that can be tested on// Android Lollipop without time consuming dex merging processes.minSdkVersion 18}prod {// The actual minSdkVersion for the application.minSdkVersion 16}}

可是编译后却出现了如下问题。

出现的原因

经过在网上查阅资料发现是因为Plugin 3.0.0之后有一种自动匹配消耗库的机制,便于debug variant 自动消耗一个库,然后就是必须要所有的flavor 都属于同一个维度。为了避免flavor 不同产生误差的问题,应该在所有的库模块都使用同一个foo尺寸。

解决问题

在主app的build.gradle里面的进行修改。

 defaultConfig {targetSdkVersion:***minSdkVersion :***versionCode:***versionName :***//版本名后面添加一句话,意思就是flavor dimension 它的维度就是该版本号,这样维度就是都是统一的了flavorDimensions "versionCode"
}

个人技术博客:https://myml666.github.io

解决Error:All flavors must now belong to a named flavor dimension相关推荐

  1. AndroidStudio Gradle 解决Error:All flavors must now belong to a named flavor dimension. Learn more at

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

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

    这个错误是说:必须要保证所有的flavor 都属于同一个维度. 3.0之前配置多版本打包是不会有问题的,可以正常运行.打包.但是AndroidStudio升级到3.0之后,配置多版本打包运行的时候会提 ...

  3. 解决Error:All flavors must now belong to a named flavor dimension. Learn more at...

    转载请标明出处:https://www.cnblogs.com/tangZH/p/10764638.html 更多精彩文章:http://77blogs.com/?p=297 低版本的gradle里面 ...

  4. 解决Error:All flavors must now belong to a named flavor dimension.

    defaultConfig {versionCode rootProject.ext.android.versionCodeversionName rootProject.ext.android.ve ...

  5. 解决AS升级3.4 ERROR: All flavors must now belong to a named flavor dimension.Learn more at https://d.and

    AS升级到3.4.2之后在多渠道环境下编译出错,错误提示为:"ERROR: All flavors must now belong to a named flavor dimension. ...

  6. ERROR: All flavors must now belong to a named flavor dimension.

    AndroidStudio升级到3.4.1之后,配置多版本打包运行的时候会提示这个错误(ERROR: All flavors must now belong to a named flavor dim ...

  7. Error:All flavors must now belong to a named flavor dimension. Learn more at

    这个问题原因是AndroidStudio升级到3.0.1之后,gradle4.1版本.会提示Error:All flavors must now belong to a named flavor di ...

  8. gradle ERROR: All flavors must now belong to a named flavor dimension.

    在升级编译器为android studio 3.4.1后项目报错如下: ERROR: All flavors must now belong to a named flavor dimension. ...

  9. 解决gradle编译报Error:All flavors must now belong to a named flavor dimension.问题

    解决方案 为productFlavors 配置 flavorDimensions "version" android {...defaultConfig {...}buildTyp ...

最新文章

  1. git diff 比较文件_使用Python创建你自己的diff工具
  2. 机器学习实践:了解数据核心的通用方法!
  3. 回归评估+解释方差分
  4. 估算神经网络卷积核数量的近似方法
  5. 跨平台SSH客户端/Linux VNC客户端/Windows RDP客户端/FTP客户端 推荐 Royal TSX
  6. 程序员小哥月入5万,却被丈母娘拒绝,丈母娘一番话让小哥很尴尬
  7. 本科毕业查重过程分享与经验
  8. libyuv NV12裁剪
  9. VPS搭建HTTP代理
  10. 1.2 编程语言选择 | 排行榜、对比、现状,java c++语言对比,哪个工资高、难度更高,mysql数据库对比,java入门怎么学
  11. 如何实现阿里云服务器数据迁移?
  12. 试试这些方法,误删文件怎么恢复?
  13. 全系统进程隐藏win7winn10win11器风铃进程隐藏器软件
  14. 3D模型制作的流程的步骤
  15. xxxiNetxxxxx2
  16. 荣耀magic5和vivox90参数对比 荣耀magic5和vivox90哪个好
  17. 用ps扣出透明背景图片,做图标的方法
  18. Spring学习笔记7_使用JSR 330标准注解(Using JSR 330 Standard Annotations)
  19. 基于yolov8的检测分割跟踪软件系统(含Pyqt界面,附下载链接和演示视频,集成四种多目标跟踪算法,模型已训好)
  20. 用批处理文件实现文件夹加密

热门文章

  1. Lake Shore低温探针台的晶圆安装方法
  2. 对项目成本和进度的监控----挣值分析
  3. windows phone水平滑动翻页动画效果
  4. python + selenium多进程爬取淘宝搜索页数据
  5. 手机网络邻居访问电脑_一起来看看手机如何访问电脑局域网共享的文件夹
  6. 【光通信】Wi-Fi联盟——Wi-Fi 7与Wi-Fi 6相比到底有哪些变化
  7. 自动驾驶传感器产业链
  8. MYSQL的sqlca详解_sql数据库如何使用
  9. “别具一格”的vue双向数据绑定原理
  10. 微信测试说了多少次我爱你的软件,微信解封次数是几次?怎么解封?