gpt4 book ai didi

android - 无法编译我的 Android 项目

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:08:51 25 4
gpt4 key购买 nike

我正在尝试编译我的 Android 版本,但出于某种原因它说有一个错误,显然是我的 Java。

Information:Gradle tasks [:assembleDebug]
: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
:compileDebugJavaWithJavac
:compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
Note: /Users/DevStarlight/Documents/Replit/platforms/android/src/org/apache/cordova/splashscreen/SplashScreen.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
:compileDebugNdk UP-TO-DATE
:compileDebugSources
: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
Error:Exception in thread "main" java.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor version 52.0
Error: at java.lang.ClassLoader.defineClass1(Native Method)
Error: at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
Error: at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
Error: at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
Error: at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
Error: at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
Error: at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
Error: at java.security.AccessController.doPrivileged(Native Method)
Error: at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
Error: at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
Error: at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
Error: at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
Error: at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)
Error:Exception in thread "main" java.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor version 52.0
Error: at java.lang.ClassLoader.defineClass1(Native Method)
Error: at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
Error: at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
Error: at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
Error: at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
Error: at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
Error: at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
Error: at java.security.AccessController.doPrivileged(Native Method)
Error: at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
Error: at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
Error: at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
Error: at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
Error: at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)
:transformClassesWithDexForDebug FAILED
Error: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 '/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1
Information:BUILD FAILED
Information:Total time: 3.606 secs
Information:29 errors
Information:0 warnings
Information:See complete output in console

在我的 Ubuntu 上它运行良好,但在 OSX 上却不行。

我的 Ubuntu 16.04 的 Java 版本是 1.7.0_80-b15,我的 OSX 是 1.7.0_79

有人知道我该怎么做才能解决这个问题吗?

最佳答案

从昨天开始就有同样的问题。

您需要从 here 安装 JDK 1.8 .我安装了 8u92 套件。

之后您需要更新 JAVA_HOME 环境变量。为了仅针对 Visual Studio 中的 Cordova 项目更新它,您可以在 Visual Studio 选项中执行此操作,如屏幕截图所示。

Visual Studio Cordova options

然后一切正常。

玩得开心! :)

关于android - 无法编译我的 Android 项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38182399/

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