gpt4 book ai didi

android - 在 Unity 中为 Android 构建 Gradle 失败,说找不到 intellij-core.jar

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

这就是我尝试过的:

  • 构建不同的项目(同一件事)
  • 重新安装 sdk、jdk 和 Unity Editor(新手 gotos)

我今天也发现了非常相似的问题:Android Studio - Could not find intellij-core.jar然而,我发现的唯一 gradle.build 文件是在 Temp 文件夹中使用 Unity 生成的文件,它会在每次构建开始后自行覆盖。

Unity 2018.2.13f1、Windows 10 x64、Fresh Android Studio 3.2.1、jdk1.8.0_192

这是控制台日志:

A problem occurred configuring root project 'gradleOut'.> Could not resolve all files for configuration ':classpath'.   > Could not find intellij-core.jar (com.android.tools.external.com-intellij:intellij-core:26.0.1).     Searched in the following locations:         https://jcenter.bintray.com/com/android/tools/external/com-intellij/intellij-core/26.0.1/intellij-core-26.0.1.jar

CommandInvokationFailure: Gradle build failed. C:\Program Files\Java\jdk1.8.0_192\bin\java.exe -classpath "C:\Program Files (x86)\Unity Editors\2018.2.13f1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-4.2.1.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx2048m" "assembleRelease"stderr[FAILURE: Build failed with an exception.* What went wrong:A problem occurred configuring root project 'gradleOut'.> Could not resolve all files for configuration ':classpath'.   > Could not find intellij-core.jar (com.android.tools.external.com-intellij:intellij-core:26.0.1).     Searched in the following locations:         https://jcenter.bintray.com/com/android/tools/external/com-intellij/intellij-core/26.0.1/intellij-core-26.0.1.jar* Try:Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.* Get more help at https://help.gradle.orgBUILD FAILED in 1s]stdout[]exit code: 1UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)UnityEditor.Android.AndroidJavaTools.RunJava (System.String args, System.String workingdir, System.Action`1 progress, System.String error)UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action`1 progress)Rethrow as GradleInvokationException: Gradle build failedUnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action`1 progress)UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context)UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context)UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

最佳答案

据报道,这对我有用 here :

  1. 进入播放器设置
  2. Publishing Settings下勾选Custom Gradle Template(然后Unity会为你创建一个build.gradle模板)
  3. 模板在 Assets > Plugins > Android > mainTemplate.gradle 中
  4. 用记事本之类的工具打开该文件
  5. 改变只有这个:

    存储库 { jcenter() google() }存储库 { google() jcenter() }

  6. 保存文件然后再次尝试构建。这不是一个完美的解决方案,但在 Unity/Android 解决问题之前它应该可以工作。我不确定这是否可以通过升级 Unity 来取消,但我知道每个项目都必须这样做。

关于android - 在 Unity 中为 Android 构建 Gradle 失败,说找不到 intellij-core.jar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52957079/

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