我已经创建了新的blankcordovapp,只是不能在andorid上运行,在windows上运行没有问题。此外,我可以通过cmd:

 cordova run android

Visual studio output:

1>  ------ Build configuration options: --debug
1>  Executing "before_compile"  hook for all plugins.
1>  ANDROID_HOME=C:\Users\dima-\AppData\Local\Android\sdk
1>  JAVA_HOME=C:\Program Files (x86)\Java\jdk1.7.0_55
1>  Reading build config file: E:\dima-\Documents\Visual Studio 2015\Projects\BlankCordovaApp1\BlankCordovaApp1\build.json
1>MSBUILD : cordova-build warning : Note: Some input files use or override a deprecated API.
1>  Note: Some input files use or override a deprecated API.
1>MSBUILD : cordova-build warning : Note: Recompile with -Xlint:deprecation for details.
1>  Note: Recompile with -Xlint:deprecation for details.
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>  :transformClassesWithDexForDebug FAILED
1>
1>  BUILD FAILED
1>
1>  Total time: 5.112 secs
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>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 ':transformClassesWithDexForDebug'.
1>  Execution failed for task ':transformClassesWithDexForDebug'.
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

CMD输出:
E:\dima-\documents\visual studio 2015\projects\blankcordovaapp1\blankcordovaapp1>cordova运行android
android_home=c:\用户\数据管理器-\appdata\local\android\sdk
JavaHoe= C:\程序文件\java\jdk1.8092
未指定目标,正在部署到设备“lgh818fdb0daf3”。
正在读取生成配置文件:e:\dima-\documents\visual studio 2015\projects\blankcordovaapp1\blankcordovaapp1\build.json
========================
//////////////////////
========================
生成成功
总时间:5.313秒
建立了以下APK:
E:/dima-/documents/visual studio 2015/projects/blankcordovaapp1/blankcordovaapp1/platforms/android/build/outputs/apk/android-debug.apk
使用apk:e:/dima-/documents/visual studio 2015/projects/blankcordovaapp1/blankcordovaapp1/platforms/android/build/outputs/apk/android-debug.apk
发射成功

最佳答案

安装Java JDK 8。
然后,转到工具->选项->为Apache Corddova>环境变量重写,并将您的JDK路径设置为“c:\程序文件\java\jdk1.80s92”,以获得Java 8而不是Java 7。

08-17 23:24