Visual Studio在Android设备上运行Ionic2应用程序

时间:2016-10-15 14:42:29

标签: android visual-studio-2015 ionic2

我尝试使用本教程使用Visual Studio 2015和Ionic2构建应用程序:

https://taco.visualstudio.com/en-us/docs/tutorial-ionic2/

在Ripple仿真器上运行应用程序没有问题,但是当我尝试使用VS仿真器或我的设备时,我会得到一长串错误。

在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"

1 个答案:

答案 0 :(得分:1)

我发现错误,xamarin指向JDK 1.7但需要1.8

更改以下设置:工具 - >选项 - > Xamarin - > Android - > Java Development Kit位置