如何在android中使用gradle根据构建变量添加JAR文件的Diff版本?
答案 0 :(得分:0)
使用compile
的构建变体版本,例如debugCompile
或flavor1Compile
。
例如,以下dependencies
闭包引用了debug
版本的项目内库模块和release
版本的工件:
dependencies {
debugCompile project(':security')
releaseCompile 'com.commonsware.cwac:security:0.6.+'
}
由于给定的构建将是debug
或 release
(不是两者),因此这两个依赖项中只有一个将用于构建。
如果您的字面意思是JAR,则需要使用指向特定JAR的...Compile files()
语句。近两年我不需要在Android版本中使用裸JAR,所以我没有那个方便的Gradle语法。