Grade build, even from inside IntelliJ IDEA does not put the dependencies into the \"External Libraries\" folder, so these classes don\'t show up as suggestions in the editor an
When importing an existing Gradle project (one with a build.gradle
) into IntelliJ IDEA, when presented with the following screen, select Import from external model -> Gradle.
Optionally, select Auto Import on the next screen to automatically import new dependencies.
In my case,I was getting error while refreshing gradle ('View'->Tool Windows->Gradle) tab and hit "refresh" and getting this error no such property gradleversion for class jetgradleplugin.
Had to install latest intellij compatible with gradle 5+
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.
For those who are getting the "Unable to resolve dependencies" error:
Toggle "Offline Mode" off
('View'->Tool Windows->Gradle)
Tried everything in this thread and nothing worked for me in IntelliJ 2020.2. This answer did the trick, but I had to set the correct path to the JDK and choose it in Gradle settings after that (as showed in figures bellow):
After that, the option "Reload All Gradle Projects" downloaded all dependencies as expected.
Cheers.
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{}