Use the Gradle wrapper to ensure you have the correct version of Gradle:
Unix like platforms (Linux, Mac OS, etc.):
./gradlew <task name>
Windows:
gradlew <task name>
You must need to edit the local.properties file to point to the location where the Android SDK is installed.