satyagvns
satyagvns

Reputation: 31

I am not able to add android platform for ionic

I start working on IONIC. When I add android to project. I am getting below error.

  1. I have installed Android Studio and pointed SDK (Latest versions)
  2. updated Cordova and IONIC
  3. JAVA version is 1.8.0.111

But still I am getting below error, Please anyone suggest me what I can do to fix this issue.

C:\shainfotech\abhayaV2>cordova platform add android --save Adding android project... Creating Cordova project for the Android platform: Path: platforms\android Package: com.ionicframework.abhayav2195873 Name: abhayaV2 Activity: MainActivity Android target: android-24 Subproject Path: CordovaLib Android project created with [email protected] Installing "cordova-plugin-console" for android ANDROID_HOME=C:\Users\satyagvns\AppData\Local\Android\sdk JAVA_HOME=C:\Program Files (x86)\Java\jdk1.8.0_111 Failed to install 'cordova-plugin-console':CordovaError: Requirements check failed for JDK 1.8 or greater at C:\shainfotech\abhayaV2\platforms\android\cordova\lib\check_reqs.js:278:19 at _fulfilled (C:\shainfotech\abhayaV2\platforms\android\cordova\node_modules\q\q.js:834:54) at self.promiseDispatch.done (C:\shainfotech\abhayaV2\platforms\android\cordova\node_modules\q\q.js:863:30) at Promise.promise.promiseDispatch (C:\shainfotech\abhayaV2\platforms\android\cordova\node_modules\q\q.js:796:13) at C:\shainfotech\abhayaV2\platforms\android\cordova\node_modules\q\q.js:604:44 at runSingle (C:\shainfotech\abhayaV2\platforms\android\cordova\node_modules\q\q.js:137:13) at flush (C:\shainfotech\abhayaV2\platforms\android\cordova\node_modules\q\q.js:125:13) at _combinedTickCallback (internal/process/next_tick.js:67:7) at process._tickCallback (internal/process/next_tick.js:98:9)

Error: Requirements check failed for JDK 1.8 or greater

Please help me to fix this issue.

Upvotes: 2

Views: 676

Answers (3)

Gandhi
Gandhi

Reputation: 11935

Removing different versions of JDK would have fixed the issue in your case. But you can still make it work even with having multiple versions of jdk.

In my case I made it work by mentioning only the required JDK's path in the 'path' environment variable. With this setting I could make it work by having multiple versions of JDKs for different project developments

Upvotes: 0

satyagvns
satyagvns

Reputation: 31

Yes, I am able to resolve issue. I have installed too many JDKs in my system. I uninstalled all versions and installed only JDK 1.8. Reboot my system.

  1. I faced one more problem like, license folder missing in my sdk
  2. Updated my Android studio with SDK 24 until license folder placed in sdk folder.
  3. ionic platform rm android
  4. ionic platform add android

It works for me.

Thank you for your support.

Upvotes: 0

Anuj
Anuj

Reputation: 650

You didn't set your path correctly. set

JAVA_HOME to the 1.8 JRE location

Refer following link https://forum.ionicframework.com/t/error-requirements-check-failed-for-jdk-1-8-or-greater/68734/8

Upvotes: 2

Related Questions