android studio build.gradle文件中的flavor依赖关系,这可能吗? [英] dependencies by flavor in android studio build.gradle file, is it possible?

查看:188
本文介绍了android studio build.gradle文件中的flavor依赖关系,这可能吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

图像具有以下依赖性:

依赖项{ 编译'com.android.support:support-v13:22.1.1' 编译'com.android.support:appcompat-v7:22.1.1' 编译'com.jakewharton:butterknife:6.0.0' }

dependencies { compile 'com.android.support:support-v13:22.1.1' compile 'com.android.support:appcompat-v7:22.1.1' compile 'com.jakewharton:butterknife:6.0.0' }

并想象我定义了以下产品口味:

and imagine i have the following product flavors defined:

productFlavors {
    germanyMock {
        applicationId "org.mymocksite.mock"
    }

    usaMock {
        applicationId "org.myqasite.qa"
    }

}

假设我只想通过风味具有依赖项,那么我可以这样做吗?

suppose i want to have a dependency by flavor only, then could i do this:

dependencies {
    compile 'com.android.support:support-v13:22.1.1'
    compile 'com.android.support:appcompat-v7:22.1.1'
    usaMockcompile 'com.jakewharton:butterknife:6.0.0'//this does not work for me
}

所以上述内容对我不起作用,但是我在想,因为有一个testCompile,而且我认为模拟编译器不应该有 flavor Compile吗?如果没有,我怎么能看到所有可用的编译"?

so the above does not work for me but i was thinking since there is a testCompile and i think a mockCompile shouldn't there be a flavorCompile ? if not how can i see all the "compiles" that are available to me ?

推荐答案

更改为usaMockCompile从c更改为C.

dependencies {
    compile 'com.android.support:support-v13:22.1.1'
    compile 'com.android.support:appcompat-v7:22.1.1'
    usaMockCompile 'com.jakewharton:butterknife:6.0.0'
}

这篇关于android studio build.gradle文件中的flavor依赖关系,这可能吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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