Reputation: 33
I am trying to create simple cordova sample and followed below step. When i am adding platform its showing the error stated "Unsupported major.minor version 52.0" . Please help on this. Thanks in advance.
Steps:
1.Installing cordova by npm install -g cordova 2. created a app by cordova create hello com.example.hello HelloWorld 3. Tried to add android platform by cordova platform add android
To resolve the error tried to install android sdk 23 ,24 and 25 4.also checked cordova requirements it showing gradle installed .
I removed platform android and tried to add it again got this same error
Error:
cordova platform add android
Adding android project...
Creating Cordova project for the Android platform:
Path: platforms\android
Package: com.example.hello
Name: HelloWorld
Activity: MainActivity
Android target: android-24
Subproject Path: CordovaLib
Android project created with [email protected]
Installing "cordova-plugin-whitelist" for android
ANDROID_HOME=C:\Users\Richa\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files\Java\jre7
Subproject Path: CordovaLib
FAILURE: Build failed with an exception.
* Where:
Build file 'G:\Pogeyan\Projects\cordova test\sample\hello\platforms\android\build.gradle' line: 20
* What went wrong:
A problem occurred evaluating root project 'android'.
> java.lang.UnsupportedClassVersionError: com/android/build/gradle/AppPlugin : Unsupported major.minor version 52.0
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 5.76 secs
Failed to install 'cordova-plugin-whitelist':Error: cmd: Command failed with exit code 1
at ChildProcess.whenDone (G:\Pogeyan\Projects\cordova test\sample\hello\platforms\android\cordova\node_modules\cordova-common\src\superspawn.js:169:23)
at emitTwo (events.js:87:13)
at ChildProcess.emit (events.js:172:7)
at maybeClose (internal/child_process.js:827:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
Error: cmd: Command failed with exit code 1
Node Version : v4.4.7
Cordova Version : 6.4.0
Upvotes: 3
Views: 1227
Reputation: 15703
I had the same error. Please downgrade the cordova version:
npm uninstall -g cordova
npm install -g [email protected]
Upvotes: 1
Reputation: 5228
Update jdk
to 1.8, make sure that your environment variable
named JAVA_HOME
point to where your jdk
1.8 is installed.
Upvotes: 2