• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
6
Question by adrianrenji · Apr 08, 2018 at 10:43 AM · build-errorexport

Change version of Gradle to 4.6

I've found that Unity whenever it builds using Gradle system it uses it's own Gradle version right now it's 4.0.1 being used.

But I would like to use my own version of gradle which is 4.6 (I don't want to depend on Unity setting up the version of gradle easier to have more control on this on my side)

I couldn't find anything to work as wrapper version seems that is not being used.


Example of the command that is using Unity :

CommandInvokationFailure: Gradle build failed. C:/Program Files/Java/jdk1.8.0_144\bin\java.exe -classpath "C:\Program Files\Unity\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-4.0.1.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx2048m" "assembleDebug"

Any Ideas ? Thanks !

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

3 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by KBaxtrom-LevelEx · Apr 25, 2018 at 05:45 PM

Did you ever find a solution to this? Hitting this issue as well

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
4

Answer by aa_unity313 · Apr 26, 2018 at 06:49 PM

@adrianrenji @KBaxtrom-LevelEx

Download your preferred gradle version: https://gradle.org/releases/

Swap the lib folder in Unity\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib with the lib folder in the downloaded zip folder.

I also ran into gradle/JDK compatibility issues while solving this issue. I had to download JDK 8 and use it instead of 9.

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image JunaidGhani · Jul 10, 2019 at 10:27 AM 0
Share

Hey this error has cost me 2 working days.. If you can explain how you solve the compatibility issue of jdk since i am already using JD$$anonymous$$ 8.

avatar image naviln · Oct 25, 2019 at 02:28 PM 0
Share

I recently updated to Unity 2019.2.10f1, and my CI android build kept failing at gradle with this:

  CommandInvokationFailure: Gradle build failed. 
     C:/Program Files/Unity/Hub/Editor/2019.2.10f1/Editor/Data/PlaybackEngines/AndroidPlayer/Tools\OpenJD$$anonymous$$\Windows\bin\java.exe -classpath "C:\Program Files\Unity\Hub\Editor\2019.2.10f1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-5.1.1.jar" org.gradle.launcher.Gradle$$anonymous$$ain "-Dorg.gradle.jvmargs=-Xmx4096m" "bundleRelease"
     
     stderr[
     
     FAILURE: Build failed with an exception.
     
     * What went wrong:
     Execution failed for task ':mergeReleaseResources'.
     > 8 exceptions were raised by workers:
       com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.4.0-5326820-windows Daemon #1: Daemon startup failed
       This should not happen under normal circumstances, please file an issue if it does.

I was pulling my hair out, following all kinds of links on the web, until i finally followed your instructions on just dropping in the latest version of gradle in that lib directory for Unity to use. Building the android via command line now works!! THAN$$anonymous$$YOU!!!

avatar image
1

Answer by JunaidGhani · Jul 10, 2019 at 12:55 PM

solved it after plenty hours of searching, installing, and uninstalling stuff: Here is what worked for me 1: OS: Windows 2: Unity version 2017.4.23.1f1 3. JDK version: jdk-8u171-windows-x64 4. NDK : android-ndk-r13b

Getting a bit technical :) -Update your SDK build tools upto 28.0.3.(must using SDK manager due to license issues: otherwise unity creates bug while building) -Change JAVA_HOME Environment variable (folder with installed JDK, usually C:\Program Files\Java\jdk1.8.0_171) -Update JDK path in edit/preferences/external Tools (same as JAVA_HOME Environment variable path).

  • Build an empty project and check if it works?

  • If it doesen't work, Delete .gradle folderfrom file from c/users/Username

  • and build your project, make sure you are connected to internet this time as Unity will download .gradle file itself.(this will take a bit long time depending on speed of your internet connection).

  • and sorry for my english :-

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

81 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Unable to build project for Android with Mac Unity version 2017.4.1f1 0 Answers

Why can't I build Web Player in Unity while I have no problems with building standalone versions? 2 Answers

Android build failure : Unable to list target platforms 0 Answers

How can I stop the variable values reverting to its default values after being built? 1 Answer

Major errors on Build/export of game (CODING HELP NEEDED) 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges