How to use gradle in command line and install plugin?

I try to use gradle to build android in command line, but it says

Failed to apply plugin [id ‘android’]

Plugin with id ‘android’ not found.

My build.gradle is

buildscript {
    repositories {
          dependencies {
        classpath ''
      apply plugin: 'android'

In Android-Studio, I can simply open the build.gradle and click sync project ,and all works. But I need to run gradle build in command line because I need to automated build my project on build server.

Instead try ‘apply plugin: ‘’’.