我正在使用unity 2018.2.0b4。我的资产中有一个android java插件,我想添加到我的最终apk中。我尚未安装Android Studio,而是手动安装了Gradle v4.2.1(还添加了其到环境的路径)。
当我在Unity-> Build settings中选择Gradle并在选择我的android设备时按build并运行时,出现此错误:
Gradle构建失败。有关详细信息,请参见Consol。
这是错误的详细信息:
CommandInvokationFailure: Gradle build failed.
C:\Program Files\Java\jdk1.8.0_172\bin\java.exe -classpath "C:\Program Files\Unity 2018.2.0b4\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-4.2.1.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx2048m" "assembleDebug"
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 com.android.tools.build:gradle:4.2.1.
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/build/gradle/4.2.1/gradle-4.2.1.pom
https://jcenter.bintray.com/com/android/tools/build/gradle/4.2.1/gradle-4.2.1.jar
https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/4.2.1/gradle-4.2.1.pom
https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/4.2.1/gradle-4.2.1.jar
Required by:
project :
* 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 16s
]
stdout[
Starting a Gradle Daemon, 1 stopped Daemon could not be reused, use --status for details
]
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)
我将mainTemplate.gradle中的jcenter()更改为mavenCentral(),但出现此错误:
A problem occurred configuring root project 'gradleOut'.
> Could not resolve all files for configuration ':classpath'.
> Could not find com.android.tools.build:gradle:4.2.1.
Searched in the following locations:
https://repo1.maven.org/maven2/com/android/tools/build/gradle/4.2.1/gradle-4.2.1.pom
https://repo1.maven.org/maven2/com/android/tools/build/gradle/4.2.1/gradle-4.2.1.jar
https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/4.2.1/gradle-4.2.1.pom
https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/4.2.1/gradle-4.2.1.jar
Required by:
project :
请问有人可以帮我吗。