Ori V Agmon
Ori V Agmon

Reputation: 19

Android studio error:Error:(23, 0) Could not find method android() for arguments on root project

I reinstalled android studio, I am using the same project with android studio in another PC so the code is probably fine! It is the full error:

 Error:(23, 0) Could not find method android() for arguments [build_1z9k6ruj47plglocgqknjnoag$_run_closure3@133cf914] on root project 'allthingsvegan-android-9d296805dc64' of type org.gradle.api.Project.

Open File


The solutions I've found on the internet was including changing the code.. So they are not relevant to me

Thanks!! build.gradle:

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.0-beta1'
        classpath 'com.google.gms:google-services:3.0.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}
allprojects {
    repositories {
        jcenter()
    }
}
task clean(type: Delete) {
    delete rootProject.buildDir
}

android {
    buildToolsVersion '24.0.1'
}

Upvotes: 1

Views: 18661

Answers (3)

Gabriele Mariotti
Gabriele Mariotti

Reputation: 363439

It is the top-level build.gradle file.
In this file you can't use this block:

android {
    buildToolsVersion '24.0.1'
}

Remove this block.

Upvotes: 2

Navin a.s
Navin a.s

Reputation: 416

  • uncomment android tag present in build.gradle(Project:android-start) enter image description here
  • rebuild the gradle it asks to update .
  • Update the gradle then sync it works

Upvotes: 0

ligi
ligi

Reputation: 39519

you need to apply the android plugin:

 apply plugin: 'com.android.application'

this needs to be done after buildscript like this:

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.0-beta1'
        classpath 'com.google.gms:google-services:3.0.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}
allprojects {
    repositories {
        jcenter()
    }
}
task clean(type: Delete) {
    delete rootProject.buildDir
}

apply plugin: 'com.android.application'

android {
    buildToolsVersion '24.0.1'
}

Upvotes: 1

Related Questions