'dependencies' cannot be applied to '(groovy.lang.Closure)'

前端 未结 15 2718
旧巷少年郎
旧巷少年郎 2020-11-30 01:28

I am unable to fix this error:

dependencies cannot be applied to \'(groovy.lang.Closure)

This is my gradle file:

buildscrip         


        
相关标签:
15条回答
  • 2020-11-30 01:52

    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

    0 讨论(0)
  • 2020-11-30 01:53

    Cut and then paste the "buildTypes" at the same place in "android" section and Re-Sync (refresh) Project

    0 讨论(0)
  • 2020-11-30 01:54

    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.

    1. Open and edit file: yourproject/gradle/wrapper/gradle-wrapper.properties. Edit content to update the gradle distribution version as shown in the image below then save.
    2. Delete this folder: yourproject/.gradle.
    3. Click Sync project with gradle files, then you are good to go.

    0 讨论(0)
  • 2020-11-30 01:56

    I fixed this issue with gradle 2.10.

    Download it here : http://gradle.org/gradle-download/

    And set your local gradle distribution like this :

    as shown here

    0 讨论(0)
  • 2020-11-30 01:58

    You can go to Preferences and select "use default gradle wrapper" then rebuild the project. It worked well for me:

    0 讨论(0)
  • 2020-11-30 02:09

    I have same problem in android studio 2.2,it work for me:

    original:

    android {
    ...
    }
    
    dependencies {
    ...
    }
    

    move dependencies in android:

    android {
    ...
       dependencies {
       ...
       }
    }
    
    0 讨论(0)
提交回复
热议问题