Android Studio - Error Building - Android tasks have already been created -


getting following error when building project:

error:(2, 0) android tasks have been created. happens when calling android.applicationvariants, android.libraryvariants or android.testvariants. once these methods called, not possible continue configuring model.

root build.gradle:

buildscript {       repositories {         jcenter()       }       dependencies {         classpath 'com.android.tools.build:gradle:1.1.0'       } } apply plugin: 'android'  android {     compilesdkversion 'google inc.:google apis:19'     buildtoolsversion '19.1.0'     defaultconfig {        versioncode 5        versionname '5'        targetsdkversion 19        minsdkversion 10        applicationid 'tsp.movil'     } } dependencies {      compile 'com.google.android.gms:play-services:7.0.0'      compile 'com.android.support:support-v4:22.1.1' } 

app build.gradle:

android {      compilesdkversion 'google inc.:google apis:19'      buildtoolsversion '19.1.0'      defaultconfig {         applicationid "tsp.movil"         minsdkversion 10         targetsdkversion 19         versioncode 5         versionname '5'      }      buildtypes {          release {             minifyenabled false             proguardfiles getdefaultproguardfile('proguard-android.txt'),      'proguard-rules.txt'          }      }      productflavors {      } } dependencies {     compile 'com.android.support:support-v4:19.1.0'     compile 'com.google.android.gms:play-services:+'     compile files('libs/zbar.jar') } 

your top level build.gradle file should have configuration common modules of project.

make following changes :

root build.gradle file should have piece of code

buildscript {       repositories {         jcenter()       }       dependencies {         classpath 'com.android.tools.build:gradle:1.1.0'       } }  allprojects{     repositories {         jcenter()       } }