Screenshot from Android my build.gradle
It's my first encounter with flavor dimensions. I am trying to compile a ready-made code but somehow I ended up with this issue.
ERROR:
All flavors must now belong to a named flavor dimension. Learn more at https://d.android.com/r/tools/flavorDimensions-missing-error-message.html Affected Modules: app
I am sorry for being a noob and really don't know how to solve this. If someone had a solution please help me with this.
How to fix this?
From the Android documentation .
All flavors must belong to a named flavor dimension, which is a group of product flavors. You must assign all flavors to a flavor dimension; otherwise, you will get the build error shown below. If a given module specifies only one flavor dimension, the Android Gradle plugin automatically assigns all of the module's flavors to that dimension .
So if you don't care about having different flavor dimension naming you can specify one inside your module
and it will be applied to all flavors
like below.
android {
...
flavorDimensions "default"
...
}
And if you care about different naming you can go with this approach:
android {
...
flavorDimensions "default"
...
}
productFlavors {
inmemory {
...
dimension "DIM_NAME"
}
live {
...
dimension "DIM_NAME_2"
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.