Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I set my Java SDK when creating an Android project in IntelliJ?

I'm trying to get an Android project running in IntelliJ by following the JetBrain instructions here but run into an error message when trying to Select the Project Template (step #2). The error is

"Cannot Create SDK

You need to configure a Java SDK first".

I'm doing this on a mac and followed the first page of instructions before the ones linked above. In particular:

  • I ran the command tools/android update sdk --no-ui from the terminal after downloading only the Android SDK content. I mention this because it says to "run the SDK Manager", but I see nothing of the sort in what I've unpacked. Running the aforementioned command downloaded and installed many Android API versions and revisions.
  • The JDK I downloaded was jdk-7u17. I installed it; is that all I need to do?

The error for "configure a Java SDK first" comes up when I press the "New..." button in step 2. Does anyone know how I can configure my Java SDK? Is there something I missed or that is missing from the JetBrain instructions?

Clicking New... causes the error here.

EDIT: Apparently, a file browser comes up after clicking OK. This confuses me further, as it accepts setting my JDK location but what I want is to view an Android project. My Android SDK is in the folder named "android-sdk-macosx", but that's not bringing up the Android options when it's selected. How do I get to the Android templates?

like image 514
Danny Avatar asked Apr 10 '13 07:04

Danny


2 Answers

Have you downloaded some of the Android SDK's? Try running tools/android sdk (this opens the SDK manager) and download one of the SDK's. Then add this to your project.

like image 72
crea1 Avatar answered Oct 27 '22 12:10

crea1


Have a look at the IntelliJ documentation, which explains how to setup your SDK.

You have to setup a JDK first (see also Setting up JDK 7 for IntelliJ on the Mac), then you will be able to open your Android project.

like image 28
Bastien Jansen Avatar answered Oct 27 '22 10:10

Bastien Jansen