这就是我尝试过的:
从今天起,我也发现了非常相似的问题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.org BUILD FAILED in 1s ] stdout[ ] exit code: 1 UnityEditor.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 failed UnityEditor.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)
答案 0 :(得分:7)
据here报道,这就是对我有用的东西:
仅更改 :
repositories { jcenter() google() }
至
repositories { google() jcenter() }
保存文件,然后重试构建。这不是一个完美的解决方案,但它应该在Unity / Android解决此问题之前起作用。我不确定是否可以通过升级Unity来撤销此操作,但是我知道必须在每个项目中完成。
答案 1 :(得分:1)
这是自我落后于代理人以来唯一适用于我的解决方案。
.gradle folder
(默认值为C:\Users\<name>\
)。gradle.properties
的文件。#http proxy setup
systemProp.http.proxyHost=<your proxy URL>
systemProp.http.proxyPort=<your proxy Port>
systemProp.http.nonProxyHosts=*.nonproxyrepos.com|localhost
#https proxy setup
systemProp.https.proxyHost=<your proxy URL>
systemProp.https.proxyPort=<your proxy Port>
systemProp.https.nonProxyHosts=*.nonproxyrepos.com|localhost
答案 2 :(得分:0)
在我的情况下,资产>插件> Android> mainTemplate.gradle已经通过jcenter()调用了,所以我只需要检查“自定义Gradle模板”就可以了!
答案 3 :(得分:0)
我知道了!在使用Firebase时也遇到了相同的错误,因此此处提到的修复无济于事,因为Firebase不断覆盖我的gradle模板。答案是这样:
https://forum.unity.com/threads/commandinvokationfailure-gradle-build-failed.573040/
祝你好运!
答案 4 :(得分:0)
如果Glen的答案对您不起作用,请通过一些修改再次执行他的步骤(https://stackoverflow.com/a/52958384/6046022):
repositories
中的Assets > Plugins > Android > mainTemplate.gradle
更改为此:repositories {
google()
jcenter()
mavenLocal()
mavenCentral()
maven { url 'https://maven.google.com' }
maven { url "https://www.jitpack.io" }
flatDir {
dirs 'libs'
}
}
我猜这是我的问题:请确保您与存储库的Internet连接正常!在某些国家/地区有限制。在这种情况下,您需要一个VPN。
最后一步重新启动Unity
构建花费了几分钟,但可以正常工作
我还更新了gralde:https://answers.unity.com/questions/1490992/change-version-of-gradle-to-46.html
但不确定是否有帮助。