30

I recently updated Android Studio to version 0.3.0 and now there are no build variants I can choose from. I have tried cleaning and rebuilding the project, and restarting Android Studio with no success. My build.gradle is

android { compileSdkVersion 18 buildToolsVersion "18.0.1" defaultConfig { minSdkVersion 9 targetSdkVersion 18 versionCode 10 } productFlavors { lite { packageName "com.lvl.xpbar" versionCode 11 } pro { packageName "com.afewguys.raisethebar" versionCode 1 } } sourceSets { main { manifest.srcFile '/src/main/AndroidManifest.xml' java.srcDirs = ['/src/main/java','.apt_generated'] resources.srcDirs = ['/src/main/java','.apt_generated'] aidl.srcDirs = ['/src/main/java','.apt_generated'] renderscript.srcDirs = ['/src/main/java','.apt_generated'] res.srcDirs = ['/src/main/res'] assets.srcDirs = ['assets'] } lite { manifest.srcFile 'src/main/AndroidManifest.xml' } pro { manifest.srcFile 'src/main/AndroidManifest.xml' } debug.setRoot('build-types/debug') release.setRoot('build-types/release') } 

Any help is greatly appreciated

2 Answers 2

45

You need to sync project with Gradle files:

In current versions of Android Studio: File -> Sync Project with Gradle Files.

In old versions (pre 3.0): Tools -> Android -> Sync Project with Gradle Files

Sign up to request clarification or add additional context in comments.

4 Comments

Doesn't exist: File -> Sync Project with Gradle Files.
I can see it using Android Studio 3.5.2 in linux. Which version and OS are you using?
thanks!, this answer works in 'Dolphin | 2021.3.1 Patch 1' also
macOS does not have this option under File
12

In your /gradle/gradle-wrapper.properties file update the following setting to:

distributionUrl=http\://services.gradle.org/distributions/gradle-1.8-all.zip 

Now, go to Tools -> Android -> Sync Project with Gradle Files

This will download the latest distribution of Gradle and automatically reload your project and build variants after it's finished.

Make sure to update your project's build.gradle files to

dependencies { classpath 'com.android.tools.build:gradle:0.6.+' } 

3 Comments

I even can't find the Tools->Android menu. My project is an android library. (I can compile and run within another project without problem.)
I think Build Variants have been removed from Android Studio but they forgot to update the documentation.
Nothing was removed. They only changed the menu - Android Studio 3.6.1: File -> Sync Project with Gradle Files

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.