I am unable to fix this error:
dependencies cannot be applied to \'(groovy.lang.Closure)
This is my gradle file:
buildscrip
Go to
Windows
File -> Settings -> Build, Execution, Deployment -> Build Tools -> Gradle
Mac
Preference -> Build, Execution, Deployment -> Build Tools -> Gradle
and select Use default gradle wrapper
Cut and then paste the "buildTypes" at the same place in "android" section and Re-Sync (refresh) Project
My problem is that the whole build.setting file were occupied with cannot be applied to '(groovy.lang.Closure)'
warning messages instead of happening on any particular variable.
I have tried all solutions provided by others but none of them works for me. I ended out doing these steps then it works like a charm. If you are encountering the same issue then give it a try.
yourproject/gradle/wrapper/gradle-wrapper.properties
. Edit content to update the gradle distribution version as shown in the image below then save.yourproject/.gradle
.Sync project with gradle files
, then you are good to go.I fixed this issue with gradle 2.10.
Download it here : http://gradle.org/gradle-download/
And set your local gradle distribution like this :
You can go to Preferences and select "use default gradle wrapper" then rebuild the project. It worked well for me:
I have same problem in android studio 2.2,it work for me:
original:
android {
...
}
dependencies {
...
}
move dependencies
in android
:
android {
...
dependencies {
...
}
}