Android的库与特定的产品口味的依赖 [英] android-library with specific Product Flavors dependency

查看:229
本文介绍了Android的库与特定的产品口味的依赖的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找类似

 应用插件:Android的图书​​馆依赖{
    flavor1Compile文件(utility.aar')
}

一切都失败:


  

找不到参数[文件收集]根工程SampleProject。方法flavor1Compile()



解决方案

库不支持的风味。

需要注意的是,因为你没有首先定义的味道,这将不是一个应用项目。你需要做的。

 安卓{
    productFlavors {
        flavor1 {}
    }
}依赖{
    flavor1Compile ...
}

它不会在其他命令工作作为宣布产品风味是创建其关联的依赖项配置。

I'm looking for something like

apply plugin: 'android-library'

dependencies {
    flavor1Compile files('utility.aar')
}

Everything fails with:

Could not find method flavor1Compile() for arguments [file collection] on root project 'SampleProject'.

解决方案

Libraries don't support flavors.

Note that this wouldn't work in a app project because you haven't defined the flavor first. You'd need to do

android {
    productFlavors {
        flavor1 {}
    }
}

dependencies {
    flavor1Compile ...
}

it wouldn't work in the other order as declaring the product flavor is what create its associated dependency configuration.

这篇关于Android的库与特定的产品口味的依赖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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