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

Notice JAVA_HOME is pointing to a 1.8 JDK. I AM able to:

  • Compile/Run with Ripple
  • Compile/Run on an iOS simulator
  • Compile/Run on an ANDROID emulator via the Ionic command line via: ionic emulate android

I battled this same problem with the command line for ionic, but solved by updating my PATH environment variables to point to a 1.8 JDK in addition to the JAVA_HOME. Is it possible that Visual Studio/MSBuild are picking up a different PATH environment variable?

BRass
  • 3,698
  • 2
  • 28
  • 46
  • 1
    From the Build log, VS is using the jdk1.8 already. Could you please try clear the cordova cache and remove the android platform and build again? – Elvis Xia - MSFT Nov 09 '16 at 02:19
  • Thanks @ElvisXia-MSFT - that suggestion worked! If you make this an answer I can mark as the answer. I can answer myself but having you answer seems more accurate :-) – BRass Nov 09 '16 at 20:28

1 Answers1

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

From the error log, VS is already using JDK 1.8. Please clear the cordova cache and remove the android platform and build again.

Community
  • 1
  • 1
Elvis Xia - MSFT
  • 10,801
  • 1
  • 13
  • 24
  • 3
    One other note for reference, in case others stumble on to this. You can override the environment variables that VS uses by going to `tools-->options-->tools for apache cordova-->environment variable overrides` – BRass Nov 10 '16 at 15:34
  • thanks so much, I have been looking for how to clear the Cordova Cache and found it in that section of the tools – Yvonne Aburrow Jan 12 '17 at 10:46