Android Studio – Build variants not showing up

Issue

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

Solution

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.+'
}

Answered By – user1107799

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published