I\'ve recently updated the android studio version of my project from 2.3 Canary 2 to 2.3 Canary 3. Since then the gradle build is failing every time with this error:
When updating to android studio 2.3, and then load an existing project for older version of android studio, It might take long if not forever on refreshing project. I had the same problem but i fixed it as follows:
It's mostly happened when setup new or update version of Android studio. I tried almost all solutions and find some fact that I like to share. It's work for me.
Control Panel\System and Security\System-> Advanced system setting -> Advanced -> Enviroment Variables -> edit Path and pest your JDK bin folder location
Ex: C:\Program Files\Java\jdk1.8.0_131\bin
Set Project-level-setting "Use default Gradle wrapper (recommended)" from,
Android Studio -> File -> Setting -> Build, Exeution, Deployment -> Gradle
Set Android Studio JDK location:
Android Studio -> File -> Project Structure -> SDK Location -> JDK location
Android Studio -> File -> Project Structure -> Project -> Gradle Version
Android Studio -> File -> Invalidate caches/ Restart...
The solution is to select "Use default gradle wrapper (recommended)" option in the build gradle panel like the image below. Now you can build with gradle 3.2 (in your gradle-wrapper.properties) and android gradle:2.3.0-alpha3 or beta1 as the time of writing
Don't forget to invalidate cache if you have some trouble using File -> Invalidate Cache / Restart