After adding productFlavors, the sync project takes more than an hour?

This is the time it takes for my project to perform synchronization, which is more than 1 hour. I am stunned. I can’t find the problem. Please help me, thank you.

The synchronization time without adding flavors is about 30 seconds. When I add productFlavor:

android{
    flavorDimensions += listOf("device", "screen", "server")
    productFlavors{
 	// 
 	device1 {
 		dimension = "device"
 	}
 	// ...
 	device11 {
 		dimension = "device"
 	}

       // screen
       screen1 {
 		dimension = "screen"
 	}
 	// ...
       screen8 {
 		dimension = "screen"
 	}

       // server
       server1 {
 		dimension = "server"
 	}
 	// ...
       server3 {
 		dimension = "server"
 	}
    }
}

Is this caused by too many productFlavors?
If this is not the problem, how should I optimize it?

Hard to say from here.
1 hour sounds like pretty much, no matter how many you have.
Maybe you need to use the gradle-profiler to find out where you spend all that time.
But also the screenshot you shows implies that you might somewhere break task-configuration avoidance and thus waste much more time than necessary be realizing and configuring all tasks.