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

前端 未结 15 2720
旧巷少年郎
旧巷少年郎 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 02:17

    I bet you the problem is totally unrelated to the piece of code that is giving you warnings, most likely it's your proguard file. I had the following in my code and got the same warning:

    buildTypes {
            release {
                runProguard false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
            }
        }
    

    By commenting out runProguard false, all of my problems go away, go figure :)

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

    I solved the problem in Android Studio by Invalidating the cache and restart.

    File-> Invalidate Caches / Restart..

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

    If you already are using the "default gradle wrapper" and it doesn't help:

    In Menu click: File -> Invalidate Caches / Restart...
    

    If it also doesn't help try in 2 steps:

    1) Delete ".gradle" folder (and "build" folder if you have it already)
    
    2) In Menu click: File -> Invalidate Caches / Restart...
    

    After restarting the warning should disappear.

    (For me it worked and for Android Studio and for IntelliJ Idea)

    0 讨论(0)
提交回复
热议问题