Join Slack
Communities
Powered by
Hi everyone, I'm trying to product flavours to an ...
# android
e
er-vprashant
01/18/2024, 12:00 PM
Hi everyone, I'm trying to product flavours to an android library. On adding couple of flavours say freeVersion flavour and PaidVersion flavour android
{
flavorDimensions "user" productFlavors
{
freeVersion
{
dimension "user" versionNameSuffix "-free"
}
paidVersion
{
dimension "user" versionNameSuffix "-paid"
}
}
sourceSets
{
main
{
java.srcDirs = ['src/main/java'] res.srcDirs = ['src/main/res']
}
freeVersion
{
it.java.srcDir "src/freeVersion/java" it.res.srcDirs = ["src/freeVersion/res"]
}
paidVersion {
it.java.srcDir "src/*paidVersion*/java" it.res.srcDirs = ["src/*paidVersion*/res"] }
}
}
getting build error
FAILURE: Build failed with an exception. * What went wrong: Task 'testDebugUnitTest' is ambiguous in root project 'Utopia' and its subprojects. Candidates are: 'testfreeVersionDebugUnitTest', 'testPaidVersionDebugUnitTest',
not kotlin but kotlin colored
3
m
Maksym M.
01/18/2024, 12:11 PM
It's literally in the error output. There are two debug test source in this case, paid and free thus ambiguity
Maksym M.
01/18/2024, 12:14 PM
https://developer.android.com/studio/test/advanced-test-setup#create-instrumented-test-for-build-variant
d
Daniel B Duval
01/18/2024, 3:16 PM
right, you’ve to have the full variant in the command, not just the build type. e.g
test${flavor}${buildType}UnitTest
where you’ll most often have
${buildType} = "Debug"
2
Views
Open in Slack
Previous
Next