Tl;dr: Adding a new product flavor makes the sync run forever.
I have a multi-module Android project set with four flavors & two flavor dimensions. The flavors are declared both in the app build.gradle and in each feature build.gradle. In case it’s relevant, for features it’s all declared in a dedicated file and applied to the feature using apply from: "$rootDir/flavor_config.gradle"
.
When adding a new flavor, regardless of it being in a new dimension or not, when hitting ‘sync’ it eventually gets stuck on “Gradle: Build model…”. I let it run once for 3 hours just to make sure and it was still running. When I removed the added flavor, everything was working fine again.
My question is: What can cause this kind of behavior? Even if there is some missing configuration or anything, I’d expect it to reach a timeout rather than running for hours, yet nothing showed up.
I tried the “regular” things to no avail:
- Invalidate cache & restart
- PC restart
- Manually deleting Gradle cache
- Playing around with the flavors config
I also tried searching the web for a few days and investigated the Android Studio logs but couldn’t come up with anything useful.
If I somehow posted it on the wrong forum, please redirect me to the right one.
Thanks a lot for your help, it’s much appreciated.