1

What are the steps to get Guava working in IntelliJIdea 2016?

And do I put the following in build.gradle?

dependencies {
compile 'com.google.guava:guava:19.0'
}
barfuin
  • 16,865
  • 10
  • 85
  • 132
Gearbox
  • 336
  • 3
  • 15

1 Answers1

0

I do the following, in the relevant project build.gradle file I add

dependencies {
    compile(group: 'com.google.guava', name: 'guava', version: rootProject.ext.GUAVA_VERSION)
}

and in the main (root) build.gradle file I add constants for the version (of this and all my other lib dependencies), which allows me to easily upgrade libraries from a single file

ext {
   GUAVA_VERSION = '18.0'
}

NB: I read about this approach in some tutorial a while ago, don't recall the exact source but it wasn't my own idea.

You don't need to separate out the version number via constant though, you can just have it all in one place if you prefer.

Let me know if this doesn't work for you for some reason.

P.S. you might want to add the following repository if you don't have any configured in the relevant module's build.gradle file (right before the dependencies clause)

repositories {
    jcenter()
}
Creos
  • 2,445
  • 3
  • 27
  • 45