2016-11-08 61 views
0

當建立在Visual Studio 2015年專業的離子應用,針對Android仿真器,我得到以下錯誤:的Visual Studio科爾多瓦建立自己的錯誤 - JDK 1.8或更高

------ Build configuration options: --debug 
Executing "before_compile" hook for all plugins. 
ANDROID_HOME=C:\Users\XXXXXXX\AppData\Local\Android\android-sdk 
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_112 
MSBUILD : cordova-build error : Requirements check failed for JDK 1.8 or greater 

通知JAVA_HOME指向一個1.8 JDK 。我AM能夠:ionic emulate android

  • 編譯/與波紋
  • 編譯/運行上的iPhone模擬器
  • 編譯/運行上的Android模擬器經由離子命令行通過運行

    我用離子命令行解決了這個問題,但是通過更新我的PATH環境變量以指向除JAVA_HOME之外的1.8 JDK來解決。有可能Visual Studio/MSBuild正在拾取不同的PATH環境變量?

+1

從Build日誌中,VS已經使用了jdk1.8。你能否嘗試清除cordova緩存並刪除android平臺並再次構建? –

+0

謝謝@ ElvisXia-MSFT - 該建議奏效!如果你把這個答案作爲答案,我可以標記爲答案。我可以回答自己,但你的答案似乎更準確:-) – BRass

回答

0

When building an ionic app in Visual Studio 2015 Professional, targeting an Android emulator, I get the following error:

------ Build configuration options: --debug Executing "before_compile" hook for all plugins. ANDROID_HOME=C:\Users\XXXXXXX\AppData\Local\Android\android-sdk JAVA_HOME=C:\Program Files\Java\jdk1.8.0_112 MSBUILD : cordova-build error : Requirements check failed for JDK 1.8 or greater

從錯誤日誌中,VS已經在使用JDK 1.8。請清除cordova緩存並刪除android平臺並重新編譯。

+2

另一個注意事項可供參考,以防其他人絆倒在這。您可以通過轉到'tools - > options - > tools for apache cordova - >環境變量覆蓋來覆蓋VS使用的環境變量' – BRass

+0

非常感謝,我一直在尋找如何清除Cordova Cache並找到它在那部分工具中 –

相關問題