Android版/摇篮:基于构建类型有条件地应用插件 [英] Android/Gradle: conditionally apply plugin based on build type

查看:249
本文介绍了Android版/摇篮:基于构建类型有条件地应用插件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想提出类似的信息(伪code):

I would like to make something like (pseudo code):

if (BuildType == "release"){
    apply plugin: 'testfairy'
} else if (BuildType == "debug"){
    apply plugin: 'io.fabric'
}

的想法是,基于所述生成类型,应用(或不)插件。怎么办呢?

The idea is that based on the build type, apply (or not) a plugin. How to do it ?

推荐答案

您可以做这样的事情你的的build.gradle

You could do something like this in your build.gradle

buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            apply plugin: 'testfairy'
        }
        debug{
            apply plugin: 'io.fabric'
        }
    }

这篇关于Android版/摇篮:基于构建类型有条件地应用插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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