Sunday, October 30, 2011

Setting up an Android project in IntelliJ Idea

And there was pain...

I imported an existing Android project into IntelliJ Idea Community Edition 10.5.1. Some things started complaining "Please select Android SDK."

The help pages are out of date; they say to do this in the Android facet settings. It isn't there.

Here is the secret do-things-right button: Module settings (ctrl-alt-shift-S), then pick Project, and then you need to change the Project SDK (1). To teach Idea where your Android SDK is, click New, and lo! There it is! The Android SDK option!

project settings screenshot


Choose Android SDK, and then select the home directory of your Android SDK installation. It will then ask you to choose a target API level. Now, the Android SDK is set.

The code still didn't compile and the Run task still complained "Please select Android SDK." Strangely, it seemed to have lost the SDK selection. I restarted Idea, opened the project structure options, and chose the Android SDK again. This time in "Edit Run Configurations", I was able to select the virtual device to run on.

If you know a better way to accomplish this setup, please comment.

(1) You could follow these steps at the module level, too.

7 comments:

  1. Project "boyfriend"? Are you using IntelliJ to solve life problems? I don't think it will work ;)

    ReplyDelete
  2. Seriously, though, what you have to do, I think is get to the "Configure SDK" screen, which you can do with "Create New Project"

    click the plus sign in the upper left

    select 'Android SDK'

    Point to your android sdk on your C: drive, likely in C:\Android\android-sdk-windows

    click ok and then ok again

    and ok a third time and finish to create your project

    your sdk should now be linked to a jdk

    I think that will solve your problem

    ReplyDelete
  3. Thanks you so much for the post I had been have a devil of a time trying to figure how to get the IDE to see the Android SDK. The instructions are dated and unclear at best.

    Honestly I would pay for an IDE (not Eclipse or IntelliJ) that would provide complete up to date instruction on some of the simplest things that a developer would want to accomplish with these tools. It's all pretty pitiful to me!!

    ReplyDelete


  4. Magnificent items from you, man. I’ve remember your stuff prior to and you are just extremely magnificent. I really
    like what you’ve acquired here, certainly like what you’re saying and the way in which by which you assert it. You’re
    making it entertaining and you continue to care for to stay it sensible. I can’t wait to learn much more from you. This
    is really a tremendous site.
    android application development

    ReplyDelete
  5. Its quite easy create Android project IntelliJ. This blog will help you learn this step by step.

    http://androidtechstuffs.blogspot.in/

    ReplyDelete
  6. Thanks you so much for the publish I had been have a demon of a moment trying to determine how to get the IDE to see the Android operating system SDK. The guidelines are old and uncertain at best. linkedin

    ReplyDelete