28

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

Darussian
  • 1,573
  • 1
  • 16
  • 28

2 Answers2

43

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

Eneko
  • 1,709
  • 1
  • 16
  • 25
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.+'
}
user1107799
  • 272
  • 2
  • 13
  • 2
    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.) – Bagusflyer Mar 27 '14 at 04:54
  • I think Build Variants have been removed from Android Studio but they forgot to update the documentation. – Pete Alvin Dec 21 '19 at 16:40
  • 3
    Nothing was removed. They only changed the menu - Android Studio 3.6.1: File -> Sync Project with Gradle Files – The incredible Jan Mar 02 '20 at 09:54