After adding dependencies open "Gradle" ('View'->Tool Windows->Gradle) tab and hit "refresh"
example of adding (compile 'io.reactivex:rxjava:1.1.0'):

If Idea still can not resolve dependency, hence it is possibly the dependency is not in mavenCentral() repository and you need add repository where this dependency located into repositories{}
You either need to import the project as a Gradle project from within Idea. When you add a dependency you need to open the Gradle window and perform a refresh.
Alternatively generate the project files from gradle with this:
build.gradle:
apply plugin: 'idea'
And then run:
$ gradle idea
If you modify the dependencies you will need to rerun the above again.
You can go to Preferences -> Build, Execution, Deployment -> Build Tools -> Maven -> Importing and check the box that says Import Maven projects automatically.
In Mac, you can do Command + Shift + A, then enter the action reimport, then click on Reimport all Maven projects.
As mentioned by @maheeka in the question's comments, if the project is a Maven project, the simplest way to achieve updating changed external libraries is to right-click on the project, and select Maven > Reload project.
You can actually see IntelliJ re-indexing the changed libraries individually during the operation in the bottom right status bar.
Tested on v2021.1 Ultimate.
In IntelliJ 2017.2 you can right-click on the project name in the Gradle Tool Window and select Refresh dependencies from the context menu.

This will refresh all your dependencies, not only the SNAPSHOTS, so it might take a while. I don't know if other versions of IntelliJ also have this feature.
I have run into some very sticky snapshots. There are a few options you can try:
- On the Gradle tab (right side of UI), click the blue circling arrows icon, which should refresh the dependencies (works in most cases)
- If that does not work, try running the gradle command in IntelliJ using the Green "run Gradle command" icon - this runs the command in IntelliJs environment not that of your local machine.
- If both of those fail, you can modify your Gradle resolutionStrategy settings to something like:
configurations.all { resolutionStrategy.cacheDynamicVersionsFor 4, 'hours' resolutionStrategy.cacheChangingModulesFor 4, 'hours' }This config change is a last-ditch option and should be used sparingly. It basically tells Gradle to refresh the local cache more often. You should click the IntelliJ Gradle refresh button after making these changes.
