我正在尝试创建简单的cordova示例,然后执行以下步骤.当我添加平台时,显示错误提示“ Unsupported major.minor version 52.0”.请帮忙.提前致谢.
脚步:
1.通过npm install -g cordova安装cordova
2.由cordova创建了一个应用,创建了一个hello com.example.hello HelloWorld
3.尝试通过cordova平台添加android平台添加android平台
要解决该错误,请尝试安装android sdk 23,24和25
4.还检查了科尔多瓦的要求,它显示安装了gradle.
我删除了Android平台,并尝试再次添加它,遇到了同样的错误
错误:
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 cordova-android@6.0.0
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
节点版本:v4.4.7
Cordova版本:6.4.0
解决方法:
我有同样的错误.请降级cordova版本:
npm uninstall -g cordova
npm install -g cordova@5.4.1