2

Question:

Is there any way to have Android Studio automatically update Gradle Plugin & Gradle to the latest versions && then immediately sync the project with the gradle files?


Background:

I've been working with native Android for over 18 months, and I frequently reference old projects. When I open older projects in the IDE, Android Studio frequently gives me an Alert "To take advantage of all the latest features...we strongly recommend that you update the Android Gradle plugin to version x.x.x and Gradle to version x.x" (see screenshot below).

Once I click Update, I must sync the project with Gradle Files (which takes forever for me). I open 15 - 20 old projects on an average day, and the message gets tedious.

Android Gradle Plugin Update Recommended ScreenShot

Zoe
  • 27,060
  • 21
  • 118
  • 148
wooldridgetm
  • 2,500
  • 1
  • 16
  • 22
  • 1
    Um, write a script to update your projects. I wrote mine in ~60 lines of Ruby. – CommonsWare Jul 25 '17 at 23:33
  • a script. of course! dunno why I didn't think of that. thanks! – wooldridgetm Jul 26 '17 at 01:11
  • btw @CommonsWare, I'm a big fan. Love your books and talks at conferences as well as all the answers you provide on StackOverflow. Keep up the great work :) – wooldridgetm Jul 26 '17 at 01:14
  • One of the handy things about text-based configuration files is the ability to beat 'em into submission with scripts when needed. :-) And thanks for the kind words! – CommonsWare Jul 26 '17 at 01:22
  • If you do actually decide to go with automatic version updates, take care to test everything after updating the project. Who knows, maybe the project you just opened has a dependency that uses some obscure internal API of the build system, that might get removed in the newer version, or whatever. One of the more recent examples I've encountered: Kotlin's annotation processor failed me on the newer version. https://youtrack.jetbrains.com/issue/KT-15359 – vadkou Jul 26 '17 at 03:02
  • @CommonsWare care to share said script? –  May 17 '22 at 22:10
  • Sorry, I haven't needed that script in years, and I don't have it handy anymore. It also wasn't exactly bulletproof -- it was adequate for my needs and my projects, nothing more. – CommonsWare May 17 '22 at 23:00

0 Answers0