在build.gradle
内部,我们可以
productFlavors {
free {
dimension "tier"
}
}
然后
dependencies { freeDebugImplementation "com.someDependency:free-debug:1.0.0";}
但是当我在Kotlin DSL
内使用build.gradle.kts
时,我
productFlavors { create("free") {...} }
然后在dependencies
中,我不能
dependencies { freeImplementation(...)}
错误:^ Unresolved reference: freeImplementation
那么,如何通过Kotlin DSL implementation
来选择特定口味?
答案 0 :(得分:3)
您应该使用示例“ YOUR_FLAVOR_NAME实现”
[root@271386b095c6 /]# ps ax
PID TTY STAT TIME COMMAND
1 ? Ssl 320:12 /usr/bin/contextBroker -fg -multiservice -ngsiv1Autocast -dbhost mongo -corsOrigin __ALL -logLevel DEBUG
9248 pts/0 Ss 0:00 bash
9293 pts/0 R+ 0:00 ps ax
}
答案 1 :(得分:1)
我 Kotlin DSL 特定于口味的依赖性如下所示:
dependencies {
"freeImplementation"(...)
"paidImplementation"(...)
}
答案 2 :(得分:0)
productFlavors {
free {
.....
}
paid {
....
}
}
在依赖项中这样写
dependencies {
freeImplementation "your dependency is here"
paidImplementation "your dependency is here"
// Other dependencies
}