如何根据android中的构建变体添加JAR文件的Diff版本?

时间:2016-02-03 12:32:43

标签: android android-studio android-gradle build.gradle

如何在android中使用gradle根据构建变量添加JAR文件的Diff版本?

1 个答案:

答案 0 :(得分:0)

使用compile的构建变体版本,例如debugCompileflavor1Compile

例如,以下dependencies闭包引用了debug版本的项目内库模块和release版本的工件:

dependencies {
    debugCompile project(':security')
    releaseCompile 'com.commonsware.cwac:security:0.6.+'
}

由于给定的构建将是debug release(不是两者),因此这两个依赖项中只有一个将用于构建。

如果您的字面意思是JAR,则需要使用指向特定JAR的...Compile files()语句。近两年我不需要在Android版本中使用裸JAR,所以我没有那个方便的Gradle语法。