Neigaard
Neigaard

Reputation: 4064

Gradle project sync failed when switching build variant

I have a Android Studio project with multiple "buildTypes" in its build.gradle file like this:

production {
    applicationIdSuffix ".some.domain.production"
    signingConfig signingConfigs.debug
}
debug {
    applicationIdSuffix ".some.domain.debug"
    signingConfig signingConfigs.debug
}

On my machine I get a "Gradle project sync failed" error every second time I switch the "Build Variant" in Android Studio and when ever I get this error Studio switches the "Build Variant" back to what ever it was before, but the other second time I do the switch it works fine. But another team member has a real problem because for him it is every time he does the switch that he gets the "Gradle project sync failed" error and as a result he can not switch "Build Variant" in Studio.

We are both running 1.1.0 stable release of Android Studio.

Has anybody seen this also? Is this a known bug in Android Studio and is there a workaround?

Upvotes: 1

Views: 576

Answers (1)

Neigaard
Neigaard

Reputation: 4064

I found a workaround. If I, right after I switch build variant in Android Studio, quickly hit APPLE+S to save all, then the gradle sync works every time and this works for everybody on the team. It seems like Android Studio does not persist everything it need to when the switch is made and thus the grade sync fails.

Upvotes: 1

Related Questions