Group Group Group Group Group Group Group Group Group

How to properly import project to IntelliJ IDEA

#1

I have installed IntelliJ IDEA CE in Mac. I have downloaded the book with its source code. I open the starter project with IntelliJ IDEA CE, but the project didn’t build successfully.

I don’t have run option when right click on the file, autocomplete didn’t work, etc.

Thank you in advance.

#2

Hi @lobothijau, thanks for the question! Which folder did you choose when you opened the project? Make sure it’s the root folder of the starter project that has the build.gradle and settings.gradle files. If that does not work, what errors do you see in the console when you open the project? Thanks again!

#3

Hi @macsimus

Its been a few days since last time I read and open IntelliJ to try and it seems my history is lost. So, I try to reimport the starter project. Unfortunately when I want to reimport it, the import window asking Gradle JVM which I don’t know where.

I’m not quite familiar with IntelliJ and I never encounter a window like this in Android Studio so I don’t really know how to fix it.

Thank you in advance.

#4

And I open the starter project which include build.gradle and settings.gradle

*I’m a new user so it’s seems I can’t post more than one image in one post.

#5

Ok thanks @lobothijau. I think the issue is you need to select a JDK installed on your machine for the Gradle JVM. You can do this by hitting the three dot menu next to that drop-down.

If you don’t have the JDK installed, you can install JDK 8 or later from here:

https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

Install the JDK on your macOS system and then try to reopen the project. Once the project opens, be sure to select “Import Changes” on the Gradle popup that you see in the bottom right of the IntelliJ window.

At that point, once the Gradle syncing and build is complete, you’ll see a Run/Play button next to the main function definition. Click that to run the code.

Thanks again and let me know if that works!