Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio - Build variants not showing up

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

like image 910
Darussian Avatar asked Oct 20 '13 17:10

Darussian


2 Answers

You need to sync project with Gradle files:

In latest version of Android Studio: File -> Sync Project with Gradle Files.

In previous versions: Tools -> Android -> Sync Project with Gradle Files

like image 50
Eneko Avatar answered Oct 12 '22 07:10

Eneko


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.+'
}
like image 12
user1107799 Avatar answered Oct 12 '22 06:10

user1107799