Gradle插件3.0.0 beta 4:"buildTypeMatching已被删除.使用buildTypes.< name> .fallbacks" [英] Gradle plugin 3.0.0 beta 4: "buildTypeMatching has been removed. Use buildTypes.<name>.fallbacks"

查看:197
本文介绍了Gradle插件3.0.0 beta 4:"buildTypeMatching已被删除.使用buildTypes.< name> .fallbacks"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

更新到Gradle插件3.0.0 beta 4后,我们的构建失败,并显示以下消息:

After updating to Gradle plugin 3.0.0 beta 4 our build failed with the following message:

buildTypeMatching已被删除.使用buildTypes.< name> .fallbacks

buildTypeMatching has been removed. Use buildTypes.<name>.fallbacks

我们的库有releasedebug buildType s,但是我们的应用程序还有两个另外的buildType s:'releaseWithLogs'和'debugMinified'.

Our libraries have release and debug buildTypes, but our app has two additional buildTypes: 'releaseWithLogs' and 'debugMinified'.

我们的应用 Gradle文件的摘要:

Snippet of our app Gradle file:

android {
    // ...
    buildTypeMatching 'releaseWithLogs', 'release'
    buildTypeMatching 'debugMinified', 'debug'

    buildTypes {
        debug {
            // ...
        }
        debugMinified {
            // ...
        }
        release {
            // ...
        }
        releaseWithLogs {
            // ...
        }
    }
}

推荐答案

经过调查,发现了以下公告:

After some investigation, the following announcement has been found: Android Studio 3.0 Beta 4 is now available. There, it mentions:

现在,您可以使用matchingFallbacks(代替buildTypeMatchingproductFlavorMatching)为缺少的构建类型和风味提供后备.您还可以使用missingDimensionStrategy(代替flavorSelection)为缺少的尺寸提供默认选择和后备广告.

You now provide fallbacks for missing build types and flavors using matchingFallbacks (which replaces buildTypeMatching and productFlavorMatching). You also provide the default selection and fallbacks for missing dimensions using missingDimensionStrategy (which replaces flavorSelection).

因此,我们之前的 app build.gradle被转换为:

So, our previous app build.gradle gets converted to:

android {
    // ...
    //buildTypeMatching 'releaseWithLogs', 'release' // remove this
    //buildTypeMatching 'debugMinified', 'debug'     // remove this

    buildTypes {
        debug {
            // ...
        }
        debugMinified {
            // ...
            matchingFallbacks = ['debug']    // instead use this
        }
        release {
            // ...
        }
        releaseWithLogs {
            // ...
            matchingFallbacks = ['release']  // instead use this
        }
    }
}

请注意,我们在buildType本身内部指定了匹配项,而不是说buildType releaseWithLogs也将与release(buildTypeMatching 'releaseWithLogs', 'release')匹配.与匹配debugdebugMinified相同.另外请注意,由于它们已经匹配,因此不必将其包含在releasedebug buildType中.

Notice that, instead of saying that buildType releaseWithLogs will also match with release (buildTypeMatching 'releaseWithLogs', 'release'), we specify the match inside the buildType itself. Same for debugMinified matching debug. Also notice that there's no need to include this in release and debug buildTypes, as they already match.

这篇关于Gradle插件3.0.0 beta 4:"buildTypeMatching已被删除.使用buildTypes.&lt; name&gt; .fallbacks&quot;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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