Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unity gradle build failed for all projects

Unity version : 2018.2.13f1

JDK version : jdk1.8.0_191

Target SDK : 26

Hi all, I was trying to integrate admob into unity, everything was fine except gradle build for android. After spent few hours and yet failed to go through the build, I restored my project back to previous revision.

But somehow, same errors was shown not only on this project, other projects as well at older revision. (I was able to build older revision with gradle.) FYI, new empty project as well.

I not sure reinstall unity will resolve the errors, below is what i tried:

  1. Custom gradle template
  2. Reinstall JDK

Here is the log:

CommandInvokationFailure: Gradle build failed.
/Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home/bin/java -classpath "/Applications/Unity/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 manifest-merger.jar (com.android.tools.build:manifest-merger:26.0.1). Searched in the following locations: https://jcenter.bintray.com/com/android/tools/build/manifest-merger/26.0.1/manifest-merger-26.0.1.jar Could not find ddmlib.jar (com.android.tools.ddms:ddmlib:26.0.1). Searched in the following locations: https://jcenter.bintray.com/com/android/tools/ddms/ddmlib/26.0.1/ddmlib-26.0.1.jar Could not find dvlib.jar (com.android.tools:dvlib:26.0.1). Searched in the following locations: https://jcenter.bintray.com/com/android/tools/dvlib/26.0.1/dvlib-26.0.1.jar Could not find common.jar (com.android.tools:common:26.0.1). Searched in the following locations: https://jcenter.bintray.com/com/android/tools/common/26.0.1/common-26.0.1.jar

like image 765
Khean Avatar asked Jun 12 '26 07:06

Khean


1 Answers

There is a workaround for this

Go to Player Settings > Publishing Settings > Build > Custom Gradle Template

Open the custom Gradle file and find 'repositories' of 'buildscript'.

Rearrange the items in it so that jcenter is not on top.

like image 52
Indika Wijesooriya Avatar answered Jun 13 '26 23:06

Indika Wijesooriya



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!