gradle - 如何仅在发布版本中使用此构建工具(容易出错)?
问题描述
我在构建中使用了一个名为“errorprone”的代码分析工具。它适用于每种发布类型,但我只想将它用于发布版本(或更具体地说,非调试版本)。我的 gradle 配置的相关部分如下所示:
plugins {
id "net.ltgt.errorprone" version "0.0.14"
}
...
tasks.withType(JavaCompile) {
options.compilerArgs += [
'-Xep:DefaultCharset:OFF',
}
...
dependencies {
errorprone 'com.google.errorprone:error_prone_core:2.3.1'
}
我已经buildTypes
为debug
和进行了配置release
。如何将容易出错的依赖项配置为仅使用release
?
解决方案
Barry, Add your dependency as
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
android.productFlavors.each {
flavor ->
if (flavor.name.contains("debug")) {
implementation 'com.google.android.exoplayer:exoplayer:2.8.4'
// add("ReleaseImplementation", ('com.android.support:leanback-v17:' + supportLibraryVersion))
//add("${flavor.name}DebugImplementation", (fileTree(include: 'vgdrm.jar', dir: "${vgdrmRootDir}/${flavor.ext.vgdrmVersion}-debug")))
}
}
推荐阅读
- excel - Excel 下拉列表在相邻列中显示值
- javascript - 用户返回页面后显示警报
- c# - AutoMapper + Blazor(WebAssembly) 缓慢的行为
- android - 无法从android相机获取输出缓冲区
- asp.net - Azure Pipelines 在 IIS 发布后删除文件并重命名
- parsing - 如何在 Haskell 中的 Functor 和 Applicative 中打印中间结果
- flutter - 我开发了提醒应用程序,因此如何在不使用 firebase 的情况下向用户发送本地通知
- symfony - API 平台 - GraphQL - 如何查询计算字段?
- html - 如何将红色 div 元素与按钮顶部对齐?
- variables - 何在 Joomla 组件上调用变量项