gpt4 book ai didi

android - 在 visual studio 中使用 apache cordova 构建 android 应用程序时出错?

转载 作者:太空狗 更新时间:2023-10-29 16:12:40 24 4
gpt4 key购买 nike

我正在尝试使用 visual studio community 2015 构建一个 android 应用程序。基本上,现在,我只是在尝试构建一个测试应用程序,以便我可以检查 IDE 是否可以完美地构建我的主要应用程序!但是当我尝试构建应用程序时,它向我显示错误。这是VS中的输出错误信息-

    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>  :transformClassesWithDexForDebug FAILED    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    1>    1>MSBUILD : cordova-build error : * Try:    1>  * Try:    1>MSBUILD : cordova-build error : Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.    1>  Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.    1>    1>  BUILD FAILED    1>    1>  Total time: 10.442 secs    1>MSBUILD : cordova-build error : Error code 1 for command: cmd with args: /s,/c,""c:\users\eather ahmed\documents\visual studio 2015\Projects\Test Project\Test Project\platforms\android\gradlew" cdvBuildDebug -b "c:\users\eather ahmed\documents\visual studio 2015\Projects\Test Project\Test Project\platforms\android\build.gradle" -Dorg.gradle.daemon=true -Pandroid.useDeprecatedNdk=true"    1>  Error code 1 for command: cmd with args: /s,/c,""c:\users\eather ahmed\documents\visual studio 2015\Projects\Test Project\Test Project\platforms\android\gradlew" cdvBuildDebug -b "c:\users\eather ahmed\documents\visual studio 2015\Projects\Test Project\Test Project\platforms\android\build.gradle" -Dorg.gradle.daemon=true -Pandroid.useDeprecatedNdk=true"    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========    ========== Deploy: 0 succeeded, 0 failed, 0 skipped ==========

这是VS中输出的完整错误信息。请帮我解决这个问题并成功构建我的应用程序!

最佳答案

从错误消息中,您收到 Unsupported major.minor version 52.0 错误,这意味着您正在使用特定的库,它需要最低版本的 Java SE 8。

因此,要解决此问题,您需要将本地 JDK 至少更新到 1.8,并配置 Tools for Apache Cordova 才能使用它。您可以在 Tools->Options->Tools for Apache Cordova->Environment Variable Overrides->JAVA_HOME 下找到该设置。

关于android - 在 visual studio 中使用 apache cordova 构建 android 应用程序时出错?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41047823/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com