Ionic的android构建错误:“所有的味道现在都必须属于一个已命名的味道维度” [英] Ionic android build error : "All flavors must now belong to a named flavor dimension"

查看:271
本文介绍了Ionic的android构建错误:“所有的味道现在都必须属于一个已命名的味道维度”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在计算机上启动了一个新项目,但无法再为android构建



运行时

 离子型cordova平台运行android 

我得到这个错误:

 所有的味道现在都必须属于一个已命名的味道维度。 


解决方案

如果您有 cordova-plugin-crosswalk-webview 插件安装在您的项目中,您尝试使用Gradle v4构建。然而,如果你想升级到 cordova-android@6.4.0 (例如打开你的Cordova Android Android Studio 3中的平台项目调试本机插件代码),则需要升级到Gradle v4。
因此 cordova-plugin-crosswalk-webview 目前与 cordova-android@6.4.0 不兼容。


$ b

作为flavors错误的手动解决方法,您可以在 platforms / android / build.gradle 请看这里):

  android {
...
flavorDimensionsdefault
...
}
$ b

更新



如果您想用Gradle v4 / cordova-android@6.4 + cordova-plugin-crosswalk-webview ,更新到Gradle v4,然后安装因为此公关 >解决多个APK版本的风味错误现在已经合并:

  cordova platform rm android 
& amp ;&安培;科尔多瓦平台添加https://github.com/apache/cordova-android


I've started a new project on my computer but I'm not able anymore to build for android

When I run

ionic cordova platform run android

I get this error :

All flavors must now belong to a named flavor dimension. 

解决方案

The "flavours" error will occur if you have the cordova-plugin-crosswalk-webview plugin installed in your project and you try to build with Gradle v4.

However, if you want to upgrade to cordova-android@6.4.0 (e.g. to open your Cordova Android platform project in Android Studio 3 to debug native plugin code), you'll need to upgrade to Gradle v4. Hence cordova-plugin-crosswalk-webview is currently incompatible with cordova-android@6.4.0.

As a manual workaround for the "flavours" error, you can insert a default flavour in the platforms/android/build.gradle (see here):

android { 
    ...
    flavorDimensions "default"
    ...
} 

Update

If you want to build with Gradle v4/cordova-android@6.4+ and cordova-plugin-crosswalk-webview, update to Gradle v4 then install cordova-android off the master branch, since this PR to resolve the "flavours" error with multiple APK builds has now been merged:

cordova platform rm android 
  && cordova platform add https://github.com/apache/cordova-android

这篇关于Ionic的android构建错误:“所有的味道现在都必须属于一个已命名的味道维度”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆