尝试模拟android时遇到错误 - 第一个离子应用程序

时间:2016-09-17 21:14:53

标签: cordova gradle ionic-framework

我昨晚刚刚下载了Ionic,我仍然在努力让事情顺利进行。这是在Windows上。我安装了离子,cordova,gradle,JDK等。

我已经搞乱了几个小时,但我对这一切都非常不熟悉,而且我撞到了墙上。有人可以帮忙吗?

C:\dev\firstIonicApp>ionic emulate android
Running command: "C:\Program Files\nodejs\node.exe" C:\dev\firstIonicApp\hooks\after_prepare\010_add_platform_class.js C:\dev\firstIonicApp


add to body class: platform-android

ANDROID_HOME=D:\Android\sdk

JAVA_HOME=C:\Program Files\Java\jdk1.7.0_79

Starting a new Gradle Daemon for this build (subsequent builds will be faster).


Incremental java compilation is an incubating feature.


:preBuild
 UP-TO-DATE

:preDebugBuild
 UP-TO-DATE
:checkDebugManifest


:CordovaLib:preBuild

UP-TO-DATE
:CordovaLib:preDebugBuild UP-TO-DATE

:CordovaLib:compileDebugNdk

UP-TO-DATE

:CordovaLib:compileLint


:CordovaLib:copyDebugLint

UP-TO-DATE
:CordovaLib:mergeDebugProguardFiles

UP-TO-DATE
:CordovaLib:packageDebugRenderscript

UP-TO-DATE
:CordovaLib:checkDebugManifest


:CordovaLib:prepareDebugDependencies


:CordovaLib:compileDebugRenderscript

UP-TO-DATE
:CordovaLib:generateDebugResValues

UP-TO-DATE
:CordovaLib:generateDebugResources
 UP-TO-DATE

:CordovaLib:packageDebugResources

UP-TO-DATE
:CordovaLib:compileDebugAidl

UP-TO-DATE
:CordovaLib:generateDebugBuildConfig

UP-TO-DATE
:CordovaLib:mergeDebugShaders

UP-TO-DATE
:CordovaLib:compileDebugShaders

UP-TO-DATE
:CordovaLib:generateDebugAssets
 UP-TO-DATE

:CordovaLib:mergeDebugAssets

UP-TO-DATE
:CordovaLib:processDebugManifest

UP-TO-DATE
:CordovaLib:processDebugResources

UP-TO-DATE
:CordovaLib:generateDebugSources
UP-TO-DATE
:CordovaLib:incrementalDebugJavaCompilationSafeguard

UP-TO-DATE
:CordovaLib:compileDebugJavaWithJavac

UP-TO-DATE
:CordovaLib:processDebugJavaRes

UP-TO-DATE
:CordovaLib:transformResourcesWithMergeJavaResForDebug

UP-TO-DATE
:CordovaLib:transformClassesAndResourcesWithSyncLibJarsForDebug

UP-TO-DATE
:CordovaLib:mergeDebugJniLibFolders

UP-TO-DATE
:CordovaLib:transformNative_libsWithMergeJniLibsForDebug

UP-TO-DATE
:CordovaLib:transformNative_libsWithSyncJniLibsForDebug

UP-TO-DATE
:CordovaLib:bundleDebug

UP-TO-DATE

:prepareAndroidCordovaLibUnspecifiedDebugLibrary

UP-TO-DATE
:prepareDebugDependencies


:compileDebugAidl

UP-TO-DATE
:compileDebugRenderscript

UP-TO-DATE
:generateDebugBuildConfig

UP-TO-DATE
:mergeDebugShaders

UP-TO-DATE
:compileDebugShaders

UP-TO-DATE
:generateDebugAssets
 UP-TO-DATE

:mergeDebugAssets

UP-TO-DATE
:generateDebugResValues

UP-TO-DATE
:generateDebugResources
 UP-TO-DATE

:mergeDebugResources

UP-TO-DATE
:processDebugManifest

UP-TO-DATE
:processDebugResources

UP-TO-DATE
:generateDebugSources
 UP-TO-DATE

:incrementalDebugJavaCompilationSafeguard

UP-TO-DATE
:compileDebugJavaWithJavac

UP-TO-DATE
:compileDebugNdk
 UP-TO-DATE

:compileDebugSources

UP-TO-DATE

:prePackageMarkerForDebug


:transformClassesWithDexForDebug


To run dex in process, the Gradle daemon needs a larger heap.
It currently has approximately 910 MB.
For faster builds, increase the maximum heap size for the Gradle daemon to more
than 2048 MB.
To do this set org.gradle.jvmargs=-Xmx2048M in the project gradle.properties.
For more information see https://docs.gradle.org/current/userguide/build_environment.html

java.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor version 52.0

java.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor version 52.0
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
        at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)
Exception in thread "main"
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
        at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)
Exception in thread "main"

:transformClassesWithDexForDebug FAILED



FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_79\bin\java.exe'' finished with non-zero exit value 1

* Try:


BUILD FAILED

Total time: 15.669 secs

Run with --stacktrace option to get the stack trace. Run with --info or --debug
option to get more log output.

Error: cmd: Command failed with exit code 1 Error output:
java.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor version 52.0
java.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor version 52.0
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
        at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)
Exception in thread "main"
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
        at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)
Exception in thread "main"

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_79\bin\java.exe'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug
option to get more log output.

1 个答案:

答案 0 :(得分:0)

您的Java版本错误。

Android SDK 24需要Java 8。