Unable to Change Build Variant
Asked Answered
G

5

10

When I changed the variants in my project with android studio 3.5 in 2019, I could not change from Active Build Variants. I solved this by deleting the .idea and Build folders of the project and changing the Varieties from Active Build Variants in a new way.

**2019 :

Project build Gradle: 3.5.3

Android Studio: 3.5**

I can't change the Variants from Active Build Variants in any way in the project by keeping the same Build Gradle the same product Flavors Configuration. This is the only difference between the previous configuration and the current one

**2020 :

Project build Gradle: 3.5.3

Android Studio: 4.0.1**

Has anyone worked with Recent Build Variants? What could be the approximate cause of this kind of problem?

build varients

Product Flavour

Grillage answered 7/9, 2020 at 8:3 Comment(0)
G
24

Try to untick File > Settings > Experimental > Gradle > Only sync the active variant

Grunion answered 8/9, 2020 at 2:23 Comment(9)
I've tried this method. But It can't change the Variants from Active Build Variants. Still Same Issues. Should I give a new windows to my laptop and reinstall my Android Studio?Grillage
This solution worked for me. I had 3 variants and was not being able to changed them. It seems the default variant was stuck. At least in my case....Hazel
Thanks this help me a lotSympathy
@Grunion yesssss it worked for me .... I spent alot of time looking for a fix. This works fine.Rightism
This worked for me, using AS 4.1.2 snap package on Manjaro linux.Harlandharle
Worked for me! Thanks.Hoick
I am using AS bumblebee on Mac. there is no such option.Kinchinjunga
@VivekMangal have you fixed this issue?Cuccuckold
I got this solution from this answer https://mcmap.net/q/379804/-unable-to-switch-to-debug-build-variant-in-android-studioHalfcaste
S
4

Maybe your project folder is in a symbol linked location, try to use the real location.

Samurai answered 3/3, 2022 at 1:7 Comment(2)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Stuccowork
This was the issue in my case. I have my project stored in iCloud Drive and had created a symlink to shorten the path. Opening the project via the symlink path broke variant switching, whereas opening at the original path worked fine.Abbey
C
4

I fixed this by resyncing the gradle. enter double shift --> then search for sync --> resync gradle with project files.

Cotterell answered 24/10, 2022 at 8:54 Comment(1)
I got this solution from this answer https://mcmap.net/q/379804/-unable-to-switch-to-debug-build-variant-in-android-studioHalfcaste
S
0

In my case I had to update the buildToolVersion as it was lower than needed with the AGP version in one of my modules. When I updated it, I could change the build variant without any problem.

Southwestwards answered 5/5, 2023 at 8:22 Comment(1)
I got this solution from this answer https://mcmap.net/q/379804/-unable-to-switch-to-debug-build-variant-in-android-studioHalfcaste
P
-1

I fixed this issue by re-cloning my project.

Patty answered 19/4 at 13:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.