Add following line in build.gradle
apply plugin: "idea"
Run following command in applications’ root directory
gradle idea --refresh-dependencies
It may take some time to download all the libraries added in build.gradle. Wait with patience until the downloads finish.
Now go to Intellij Idea and it will prompt to reload the project with the libraries.