Saturday, May 17, 2014

Adding android module to an imported android project in IntelliJ

I started using IntelliJ recently - and was mighty pleased using it. For my Android apps, I used to use Eclipse before - but I decided to migrate those projects to IntelliJ as well. Hit some roadblocks - so here are some notes for myself (and others reading this post).

I am using IntelliJ v13.1.2, which is fairly recent. My app was meant to be compiled using Android SDK for v3.2 (Gingerbread).

First off, I imported the project in IntelliJ using the 'File -> Import Project' menu item. I had to just point to the Eclipse .project file, and IntelliJ did the rest to import the project, and opened in a new window. However, when I tried rebuilding the project, I got the following message:
Error: Android Source Generator : [] Android SDK is not specified
Screenshot 1: Error Message

Looks like, it was not able to get the Android SDK information. I have already installed the Android SDK in my Windows 7 laptop, so obviously, I am missing some connection setting somewhere.

Here is how I fixed it, after doing some web searches.

Go to File -> Project Structure. Here, click on the 'Modules' link on the left hand side. Now on the right hand side, in the 'Dependencies' tab, you would see that the Android SDK is not mentioned. Hit 'New..' button by the side of the drop down and select 'Android SDK'. From there, it should be pretty obvious what needs to be done to add your required android SDK to your project.

Some screenshots along the way:
Screenshot 2: Adding Android SDK
Screenshot 3: After adding Android SDK
Hope this helps me the next time.