我尝试使用本教程使用Visual Studio 2015和Ionic2构建应用程序:
https://taco.visualstudio.com/en-us/docs/tutorial-ionic2/
在Ripple Emulator上运行该应用程序可以正常工作,但是当我在VS Emulator或我的设备上尝试该应用程序时,会看到一堆错误。
通过Android Studio,我可以在设备上运行应用程序而不会出现问题。
输出列表很长,您可以在此处找到完整的列表:
输出:http://pastebin.com/UYhXnjFm
这是输出日志中的一些条目:
1>MSBUILD : cordova-build error : java.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor version 52.0
1> java.lang.UnsupportedClassVersionError com/android/dx/command/Main : Unsupported major.minor version 52.0
1>MSBUILD : cordova-build error : at java.lang.ClassLoader.defineClass1(Native Method)
1> at java.lang.ClassLoader.defineClass1(Native Method)
1>MSBUILD : cordova-build error : at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
1> at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
1>MSBUILD : cordova-build error : at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
1> at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
1>MSBUILD : cordova-build error : at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
1> at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
1> :transformClassesWithDexForRelease FAILED
1>
1> BUILD FAILED
1> Total time: 5.223 secs
1>MSBUILD : cordova-build error : at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
1> at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
1>MSBUILD : cordova-build error : at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
1> at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
1>MSBUILD : cordova-build error : at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
1> at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
1>MSBUILD : cordova-build error : at java.security.AccessController.doPrivileged(Native Method)
1> at java.security.AccessController.doPrivileged(Native Method)
1>MSBUILD : cordova-build error : at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
1> at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
1>MSBUILD : cordova-build error : at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
1> at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
1>MSBUILD : cordova-build error : at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
1> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
1>MSBUILD : cordova-build error : at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
1> at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
1>MSBUILD : cordova-build error : at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)
1> at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)
1>MSBUILD : cordova-build error : Picked up _JAVA_OPTIONS: -Xmx512M
1> Picked up _JAVA_OPTIONS: -Xmx512M
1>MSBUILD : cordova-build error : Exception in thread "main"
1> Exception in thread "main"
1>MSBUILD : cordova-build error : java.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor version 52.0
1> java.lang.UnsupportedClassVersionError com/android/dx/command/Main : Unsupported major.minor version 52.0
1>MSBUILD : cordova-build error : at java.lang.ClassLoader.defineClass1(Native Method)
1> at java.lang.ClassLoader.defineClass1(Native Method)
1>MSBUILD : cordova-build error : at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
1> at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
1>MSBUILD : cordova-build error : at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
1> at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
1>MSBUILD : cordova-build error : at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
1> at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
1>MSBUILD : cordova-build error : at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
1> at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
1>MSBUILD : cordova-build error : at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
1> at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
1>MSBUILD : cordova-build error : at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
1> at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
1>MSBUILD : cordova-build error : at java.security.AccessController.doPrivileged(Native Method)
1> at java.security.AccessController.doPrivileged(Native Method)
1>MSBUILD : cordova-build error : at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
1> at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
1>MSBUILD : cordova-build error : at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
1> at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
1>MSBUILD : cordova-build error : at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
1> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
1>MSBUILD : cordova-build error : at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
1> at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
1>MSBUILD : cordova-build error : at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)
1> at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)
1>MSBUILD : cordova-build error : Picked up _JAVA_OPTIONS: -Xmx512M
1> Picked up _JAVA_OPTIONS: -Xmx512M
1>MSBUILD : cordova-build error : Exception in thread "main"
1> Exception in thread "main"
1>
1>MSBUILD : cordova-build error : FAILURE: Build failed with an exception.
1> FAILURE: Build failed with an exception.
1>
1>MSBUILD : cordova-build error : * What went wrong:
1> * What went wrong:
1>MSBUILD : cordova-build error : Execution failed for task ':transformClassesWithDexForRelease'.
1> Execution failed for task ':transformClassesWithDexForRelease'.
1>MSBUILD : cordova-build error : > com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files (x86)\Java\jdk1.7.0_55\bin\java.exe'' finished with non-zero exit value 1
1> > com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files (x86)\Java\jdk1.7.0_55\bin\java.exe'' finished with non-zero exit value 1
1>
错误输出:
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
TS2664 Invalid module name in augmentation, module '../../Observable' cannot be found.
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.defineClass(ClassLoader.java:800)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
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)
Picked up _JAVA_OPTIONS: -Xmx512M
Exception in thread "main"
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.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)
Picked up _JAVA_OPTIONS: -Xmx512M
Exception in thread "main"
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':transformClassesWithDexForRelease'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files (x86)\Java\jdk1.7.0_55\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.
Error code 1 for command: cmd with args: /s,/c,"D:\Dropbox\Entwicklung\VS\evmwi\evmwi\platforms\android\gradlew cdvBuildRelease -b D:\Dropbox\Entwicklung\VS\evmwi\evmwi\platforms\android\build.gradle -Dorg.gradle.daemon=true -Pandroid.useDeprecatedNdk=true"
最佳答案
我发现了错误,xamarin指向JDK 1.7,但需要1.8
在以下位置更改设置:工具->选项-> Xamarin-> Android-> Java开发工具包位置