After updating to Gradle plugin 3.0.0 beta 4 our build failed with the following message:
buildTypeMatching has been removed. Use buildTypes.<name>.fallbacks
Our libraries have release
and debug
buildType
s, but our app has two additional buildType
s: 'releaseWithLogs' and 'debugMinified'.
Snippet of our app Gradle file:
android {
// ...
buildTypeMatching 'releaseWithLogs', 'release'
buildTypeMatching 'debugMinified', 'debug'
buildTypes {
debug {
// ...
}
debugMinified {
// ...
}
release {
// ...
}
releaseWithLogs {
// ...
}
}
}
After some investigation, the following announcement has been found: Android Studio 3.0 Beta 4 is now available. There, it mentions:
You now provide fallbacks for missing build types and flavors using
matchingFallbacks
(which replacesbuildTypeMatching
andproductFlavorMatching
). You also provide the default selection and fallbacks for missing dimensions usingmissingDimensionStrategy
(which replacesflavorSelection
).
So, our previous app build.gradle gets converted to:
android {
// ...
//buildTypeMatching 'releaseWithLogs', 'release' // remove this
//buildTypeMatching 'debugMinified', 'debug' // remove this
buildTypes {
debug {
// ...
}
debugMinified {
// ...
matchingFallbacks = ['debug'] // instead use this
}
release {
// ...
}
releaseWithLogs {
// ...
matchingFallbacks = ['release'] // instead use this
}
}
}
Notice that, instead of saying that buildType
releaseWithLogs
will also match with release
(buildTypeMatching 'releaseWithLogs', 'release'
), we specify the match inside the buildType
itself. Same for debugMinified
matching debug
. Also notice that there's no need to include this in release
and debug
buildType
s, as they already match.
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