Fix Gradle warnings after Android Studio 1.3 update

Have you just updated Android Studio to version 1.3 Beta and have you found yourself overwhelmed by all the warnings in the Gradle files?

Screen Shot 2015-06-21 at 17.48.51

Gradle warnings

‘dependencies’ cannot be applied to ‘(groovy.lang.Closure)’
‘defaultConfig’ cannot be applied to ‘(groovy.lang.Closure)’
and so on….

Feeling desperate? Now you’re wondering why you press that update button… Don’t worry!
To fix the issue simply close the project (File / Close project), then select “Open an existing Android Studio project” on the start menu and select the folder that contains your Android project. Beware, select the folder, not the .iml project file.

Android Studio would take care to upgrade the project files and some extra xml files.
Now you should only need to accept to add the folder as VCS root (you’re versioning your code, right??), update the main build.gradle file (the one shown in the image that resides in the root project folder) to use Gradle 1.2.3 and you are reading to go!

Happy coding!

  • Roy

    Not working on my end…:(

    • http://alessio.franceschelli.me Alessio Franceschelli

      Please double check you selected the folder that contains the android project and not the .iml file

  • http://alessio.franceschelli.me Alessio Franceschelli

    Please double check you selected the folder that contains the android project and not the .iml file

  • CONTINUUM

    Thank god this was on the first page of Google — I was so close to not finding it because it was the last result. Thank you.

  • Romeo Tevez

    Not Working too,(the folder has been selected)/

  • Daniel

    Thanks. It helped me after updating from Android Studio 1.3.2 to 1.5.1.

  • Russell Brown

    Yay, worked for me! Now, my question is why this worked? What does that do that upgrading Android Studio doesn’t do?

  • Kennety

    Thank’s a lot man. It works for me