Could not find method android() for arguments org.gradle.api.Project

There are two build.gradle files. One is in the top-level holder, and the other is in module holder.

Below is an example.

Top-level build.gradle:
https://github.com/nickbutcher/plaid/blob/master/build.gradle

module's build.gradle:
https://github.com/nickbutcher/plaid/blob/master/app/build.gradle

The android block should be in module's build.gradle. I guess you must have defined the android block in top-level build.gradle which is causing the error.


I had same problem if your android block is in module's build.gradle and use google services, just add these 2 lines before android block:

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'