I'm having issues specifying different dependencies for debug
and release
build types combined with dimensions.
In my app.gradle
I specified 1 dimension and 2 productFlavors, like so:
android {
[...]
flavorDimensions "tier"
productFlavors {
free {
dimension "tier"
}
paid {
dimension "tier"
}
}
}
Now I want to specify different dependencies for all the build variants (freeDebug, freeRelease, paidDebug, paidRelease), and I tried doing it like so:
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";
}
However, this fails with
Could not find method freeDebugImplementation() for arguments [com.someDependency:free-debug:1.0.0] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
Maybe I'm approaching this requirement the wrong way. Any help will be greatly appreciated.
P.S I'm using version 3.1.2
of the android gradle plugin, and version 4.7
of the gradle wrapper.
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
}
I don't know whether that's still the case, but worth a shot.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With