Skip to content

Conversation

@Legion2
Copy link
Contributor

@Legion2 Legion2 commented Sep 18, 2021

This change uses the mergedFlavor if there are no productFlavors. This allows to use missingDimensionStrategy in the defaultConfig.

fixed #343

ProductFlavor flavor = variant.productFlavors.isEmpty() ? variant.mergedFlavor : variant.productFlavors.first()
flavor.missingDimensionStrategies.find { entry ->
String toDimension = entry.getKey()
String toFlavor = entry.getValue().getFallbacks().first()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kezong should't we first try the requested value and then try all the fallbacks?

Suggested change
String toFlavor = entry.getValue().getFallbacks().first()
String toFlavor = entry.getValue().requested

Because the semantic of missingDimensionStrategy is as follows:
missingDimensionStrategy 'dimension', 'requested', 'fallback1', 'fallback2' ...

getFallbacks().first() would select fallback1 and skipping requested and ignoring the other fallbacks.

As a result missingDimensionStrategy 'dimension', 'requested' causes an exception, because it has not fallbacks.

@kezong kezong merged commit bf3f346 into kezong:master Nov 8, 2021
@Legion2 Legion2 deleted the support-default-flavor-missingDimensionStrategies branch April 24, 2024 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support missingDimensionStrategy without productFlavors in current project

2 participants