2013-08-06 98 views
7

我正在使用默認情況下包含Android支持的Windows 7中的IntelliJ Idea 12.1.4 Community Edition。IntelliJ Idea未能創建新的Android應用程序項目

我可以導入使用Eclipse創建的Android項目,並且它們在IntelliJ中工作正常。但是當我嘗試在IntelliJ中創建一個新的Android項目時,它沒有這樣做。它顯示一個對話框

Cannot find resource directory for module [ProjectName]

然後在Android的控制檯:

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.

我已經試過兩個答案來自以下幾個問題:
intellij IDEA - create android app failed
IntelliJ IDEA 12 - New Android Application Module wizard fails with "cannot find resource directory for module"
但兩者的答案未能解決這個。

編輯:在IntelliJ IDEA的SDK的路徑的 Screeshots

JDK路徑:
enter image description here

Android SDK中路徑:
enter image description here

+0

請在IDEA中添加顯示您的JDK和Android SDK配置的屏幕截圖。 – CrazyCoder

+0

@CrazyCoder我已經添加了您請求的JDK和Android SDK配置的屏幕截圖。 – Krish

+3

它看起來像'android.bat'文件正在調用'lib \ find_java.bat',它使用'lib \ find_java.exe'來定位系統上的Java安裝,但它檢測到錯誤的版本。您可以重新安裝JDK並定義將指向正確的JDK安裝目錄的'JAVA_HOME'環境變量。 – CrazyCoder

回答

6

謝謝@CrazyCoder作爲評論你的答案。

我在環境變量中添加了一個名爲JAVA_HOME的新變量,其中包含JDK路徑 - C:\Program Files\Java\jdk1.7.0_25作爲值。

現在IntelliJ Idea成功創建新的Android項目。

相關問題