Joa*_*usa 6 android gradle android-gradle-plugin
我在为维度指定不同的依赖项debug和release构建类型时遇到问题。
在我的app.gradle我指定1 维和2 productFlavors,像这样:
android {
[...]
flavorDimensions "tier"
productFlavors {
free {
dimension "tier"
}
paid {
dimension "tier"
}
}
}
Run Code Online (Sandbox Code Playgroud)
现在我想为所有构建变体(freeDebug、freeRelease、paidDebug、paidRelease)指定不同的依赖项,我尝试这样做:
dependencies {
freeDebugImplementation "com.someDependency:free-debug:1.0.0";
paidDebugImplementation "com.someDependency:paid-debug:1.0.0";
freeReleaseImplementation "com.someDependency:free-release:1.0.0";
paidReleaseImplementation "com.someDependency:paid-release:1.0.0";
}
Run Code Online (Sandbox Code Playgroud)
然而,这失败了
android {
[...]
flavorDimensions "tier"
productFlavors {
free {
dimension "tier"
}
paid {
dimension "tier"
}
}
}
Run Code Online (Sandbox Code Playgroud)
也许我以错误的方式接近这个要求。任何帮助将不胜感激。
PS 我正在使用3.1.2android gradle 插件版本4.7和 gradle 包装器版本。
This section of the Android Studio manual indicates that you need to explicitly declare variant configurations before you use them, i.e. with this:
configurations {
freeDebugImplementation
paidDebugImplementation
freeReleaseImplementation
paidReleaseImplementation
}
Run Code Online (Sandbox Code Playgroud)
I don't know whether that's still the case, but worth a shot.
| 归档时间: |
|
| 查看次数: |
2509 次 |
| 最近记录: |