【问题标题】:Build Error in Unity3d: Could not determine the dependencies of task ':launcher:compileDebugJavaWithJavac'. ':launcher:debugRuntimeClasspath'Unity3d 中的构建错误:无法确定任务 ':launcher:compileDebugJavaWithJavac' 的依赖关系。 ':launcher:debugRuntimeClasspath'
【发布时间】:2022-01-05 22:07:37
【问题描述】:

在我的 Unity3d 项目中添加 Firebase Cloud 功能后出现此错误。

有人遇到同样的问题吗?

我们已经尝试过“flutter doctor --android-licenses”,就像在 https://github.com/flutter/flutter/issues/30573

到目前为止没有任何效果。

以下是完整的错误消息。

================================================ =

CommandInvokationFailure: Gradle build failed. 
C:\Program Files\Unity\Hub\Editor\2020.3.19f1\Editor\Data\PlaybackEngines\AndroidPlayer\OpenJDK\bin\java.exe -classpath "C:\Program Files\Unity\Hub\Editor\2020.3.19f1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-6.1.1.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "assembleDebug"

stderr[

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':launcher:compileDebugJavaWithJavac'.
> Could not resolve all dependencies for configuration ':launcher:debugRuntimeClasspath'.
   > Cannot set the value of read-only property 'class' for object of type org.gradle.api.internal.artifacts.DefaultExcludeRule.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1s
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
]
stdout[

> Configure project :launcher
WARNING: The option setting 'android.enableR8=false' is deprecated.
It will be removed in version 5.0 of the Android Gradle plugin.
You will no longer be able to disable R8
]
exit code: 1

UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <c8b3b39837d14a59b516963b78bf9032>:0)
UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <c8b3b39837d14a59b516963b78bf9032>:0)
UnityEditor.Android.Command.Run (System.String command, System.String args, System.String workingdir, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <c8b3b39837d14a59b516963b78bf9032>:0)
UnityEditor.Android.AndroidJavaTools.RunJava (System.String args, System.String workingdir, System.Action`1[T] progress, System.String error) (at <c8b3b39837d14a59b516963b78bf9032>:0)
UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action`1[T] progress) (at <c8b3b39837d14a59b516963b78bf9032>:0)
Rethrow as GradleInvokationException: Gradle build failed
UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action`1[T] progress) (at <c8b3b39837d14a59b516963b78bf9032>:0)
UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <c8b3b39837d14a59b516963b78bf9032>:0)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <c8b3b39837d14a59b516963b78bf9032>:0)
Rethrow as BuildFailedException: Exception of type 'UnityEditor.Build.BuildFailedException' was thrown.
UnityEditor.Android.PostProcessor.CancelPostProcess.AbortBuild (System.String title, System.String message, System.Exception ex) (at <c8b3b39837d14a59b516963b78bf9032>:0)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <c8b3b39837d14a59b516963b78bf9032>:0)
UnityEditor.Android.PostProcessAndroidPlayer.PostProcess (UnityEditor.BuildTarget target, System.String stagingAreaData, System.String stagingArea, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at <c8b3b39837d14a59b516963b78bf9032>:0)
UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <c8b3b39837d14a59b516963b78bf9032>:0)
UnityEditor.PostprocessBuildPlayer.Postprocess (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget target, System.String installPath, System.String companyName, System.String productName, System.Int32 width, System.Int32 height, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at <97ba64834c8f4edc84e3d8e30b04f122>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)

【问题讨论】:

    标签: android unity3d build


    【解决方案1】:

    经过几天的折磨(不是几个小时),我们最终可以建造。但以下是我们发现的一个令人惊讶的事实。在 Unity3d 中,三个 google 包 firebase、google-signin 和 googleMobileAds 存在无法解决的依赖问题,因此我们无法成功构建。所以在所有组合试验结束时,我们决定从我们的项目中删除 googleMobileAds,然后我们终于可以成功地为“Android”构建。

    我们在没有任何代码的情况下尝试了一个空项目。结果是一样的。失败的。上面提到的包在空场景中使用空的 unitypackage 构建失败。

    我会给你每个包的详细版本。

    Unity3d (Unity 2020.3.19f1)

    firebase_unity_sdk.8.6.2

    google-signin-plugin-1.0.4

    GoogleMobileAds-v6.1.2

    【讨论】:

      【解决方案2】:

      我遇到了类似的问题,原因是使用 gradle 版本 32.0.0。

      请查看此链接表单 unity issuetracker:

      所以我通过卸载构建工具 32.0.0 并改用 30.0.2 来解决它(来自 sdk 管理器)。

      [Android sdk 构建工具]:https://i.stack.imgur.com/mo6SB.png

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2021-11-02
        • 1970-01-01
        • 2020-04-15
        • 2021-06-18
        • 1970-01-01
        • 2020-07-11
        • 2020-09-17
        相关资源
        最近更新 更多