androidunity-game-enginegradlemobilearcore

Can't compile Unity Project with ARCore SDK - Problem with Gradle


I am trying to solve this problem for a few days now. Whenever I import ARCore SDK, to Unity, I cannot compile my project.

The error I am facing now is: Minimum supported Gradle version is 5.6.4. Current Version is 5.1.1. If using the gradle wrapper, try editing the distributionUrl. enter image description here

I did so, I saw in my eyes a new version is imported but I am keep getting this error.

Here are some other things I tried:

  1. Trying to import the SDK to multiple versions of Unity.
  2. Using a different computer.
  3. Not changing the minimum API Level to 24.
  4. Building the app without scenes.
  5. trying to use different Gradle versions besides 5.6.4. In particular, 6.7, 6.1.1
  6. Creating a system variable under Path: C:\Gradle\gradle-6.7\bin
  7. Removing 5.1.1 folder from the Temp folder of the project, whenever I compile it (Although it keeps appearing of course)
  8. Following the guide found at: https://developers.google.com/ar/develop/unity/quickstart-android
  9. Ensuring JDK, JVM and all required components are installed.

All to no avail. The project is not compiling.

Any help would be greatly appreciated!

EDIT: I believe the root of the problem is that I haven't changed the Gradle version somewhere, despite doing so at the wrapper. The reason I stuck at 5.1.1 has something to do with the default Gradle version of my Unity version. https://docs.unity3d.com/Manual/android-gradle-overview.html

Question is, how to solve it.

enter image description here enter image description here


Solution

  • I can think about two ways to solve it (but they are pretty similar):

    First Option:

    Download the gradle version you want, navigate to where Unity's gradle is located in: C:/{UnityEditorsDirectory}/{UnityVersionDirectory}/Editor/Data/PlaybackEngines/AndroidPlayer/Tools/gradle

    Then replace lib folder with your new gradle lib folder.

    Second Option:

    In case this doesn't work, you can also try to:

    Open Unity Editor, go to the menu tab Edit->Preferences->External Tools

    Scroll down and find this toggle: enter image description here If you uncheck the toggle, the editor will allow you to browse where your gradle is located, paste your new directory and try if it works.

    TAKE CARE: Unity's gradle version is the one that Unity's people have tested so...something can explode unexpectedly!