https://kotlinlang.org logo
#intellij
Title
# intellij
i

ian.shaun.thomas

03/04/2024, 4:08 PM
Who decided that gradle sync in a project that has Android literally anywhere in it should change your selected build configuration to whatever Android target it can find anytime you sync. Can you turn this "feature" off?
plus one 3
1
Even if you delete the android configurations from your list a sync will just add it back and select it. I might find this ok if I was using studio but I'm not.
r

Roman Golyshev

03/04/2024, 8:14 PM
Hi! Just in case, could you please clarify what do you mean by “Build Configuration”? How does this problem manifest itself in your workflow?
i

ian.shaun.thomas

03/04/2024, 8:15 PM
The selected build configuration from the drop down that the green play button executes. Select literally any non android configuration and if Android is in the project, a gradle sync will cause it to change from your selection to what I imagine is the first android application target it can find. It's extremely annoying.
this drop down
👍 1
r

Roman Golyshev

03/04/2024, 8:39 PM
There is a really similar issue in the Android Bug tracker: https://issuetracker.google.com/issues/308994083 I am not sure if this is a problem on the IntelliJ/Kotlin side, though. To me it looks like an Android Plugin-specific issue. I also observe that this forced configuration seems to be recreated on every gradle sync, maybe that’s one of the reasons for such behavior You’ve only observed this in the projects with Gradle and at least one Android module, right?
i

ian.shaun.thomas

03/04/2024, 8:41 PM
Right, it's definitely AGP related and that is the same issue I'm describing.
It would be nice if Intellij didn't allow, and I'll be generous here and call it misbehaving plugins, to change your selected build configuration directly or indirectly, whichever is happening in this case.
r

Roman Golyshev

03/04/2024, 8:44 PM
Just to be clear: your configurations themselves (i.e. the specified command line arguments, etc.) did not change, right? Only the configuration selection is affected by the Gradle Sync?
i

ian.shaun.thomas

03/04/2024, 8:45 PM
Existing configurations are not changed. Gradle sync causes an Android one to be generated which I would argue it should not be allowed to do. Also, it will select either an existing Android configuration or the newly created one.
t

twisterrob

03/05/2024, 9:20 AM
I've also observed this way too many times in mixed projects. I'm using npm/js mainly and there's a test project that's Android, when syncing the android project it just thinks "I'm the most important in the world, ignore what the user wants".
🤝 1
Ian, comment and upvote on the linked issue, if they don't know your use case / you're affected it never gets prioritised.
I agree JB should forbid this, but that's way less likely than getting Android plugin to behave directly.
i

ian.shaun.thomas

03/05/2024, 3:09 PM
I feel like agp behaving correctly is the least likely 😂 but yes I'll comment