7

I am using IntelliJ Idea 12.1.4 Community Edition in Windows 7 which contains Android Support by default.

I can import Android projects which were created using Eclipse and they are working fine in IntelliJ. But when I tried to create a new Android Project in IntelliJ it failed to do so. It is showing a dialog box

Cannot find resource directory for module [ProjectName]

Then in Android Console:

The project wasn't generated by 'android' tool.

'C:\Windows\system32\java.exe' is not recognized as an internal or external command, operable program or batch file.

Invalid path

ERROR: SWT folder '' does not exist.

Please set ANDROID_SWT to point to the folder containing swt.jar for your platform.

I have tried both answers from the following questions:
intellij IDEA - create android app failed
IntelliJ IDEA 12 - New Android Application Module wizard fails with "cannot find resource directory for module"
But both answers has failed to solve this.

Edit: Screeshots of SDKs' path in IntelliJ Idea

JDK Path:
enter image description here

Android SDK Path:
enter image description here

Community
  • 1
  • 1
krishh
  • 1,551
  • 15
  • 28
  • Please add the screenshots showing your JDK and Android SDK configuration in IDEA. – CrazyCoder Aug 07 '13 at 01:01
  • @CrazyCoder I have added the screenshots of JDK and Android SDK configuration as you request. – krishh Aug 07 '13 at 10:56
  • 3
    It looks like `android.bat` file is calling `lib\find_java.bat` that is using `lib\find_java.exe` to locate Java installation on your system, but it detects the wrong version. You can reinstall the JDK and define `JAVA_HOME` environment variable that will point to the correct JDK installation directory. – CrazyCoder Aug 07 '13 at 11:09

1 Answers1

6

Thank you @CrazyCoder for your answer as in comment.

I added a new variable in Environment Variables called JAVA_HOME with JDK path - C:\Program Files\Java\jdk1.7.0_25 as value.

Now IntelliJ Idea creating new Android Projects successfully.

krishh
  • 1,551
  • 15
  • 28