Q:

Gradle DSL method not found: 'google()'

i update my android studio from 2.2.2 to 3.1.2 and when i sync my previous project i got following error. what's the problem guys. what i am doing wrong ?
Gradle DSL method not found: 'google()'
Possible causes:
The project 'TestProject' may be using a version of the Android Gradle plug-in that does not contain the method (e.g. 'testCompile' was added in 1.1.0).
    Upgrade plugin to version 3.1.2 and sync projectThe project 'TestProject' may be using a version of Gradle that does not contain the method.
    Gradle settingsThe build file may be missing a Gradle plugin.
    Apply Gradle plugin

A:

google() method was only added to RepositoryHandler only in Gradle 4.0. Update your Gradle wrapper to use more recent version: 
./gradlew wrapper --gradle-version=4.7 --distribution-type=all

or explicitly set Google's Maven repository, instead of
google()

write
maven { url 'https://maven.google.com' }

