Unity gradle templates folder missing (2021.3.6f)

Viewed 667

I installed unity 2021.3.6f with android build support (NDK and SKD) using unity hub.

Going into a project and attempting to build it on android platform , I get this error :

FileNotFoundException: Failed to find $C:/ProgramFiles/Unity/Hub/Editor/2021.3.6f1/Editor/Data/PlaybackEngines/AndroidPlayer/Tools\GradleTemplates\mainTemplate.gradle

I looked up in the directory and I don't even have the /Tools folder inside /AndroidPlayer. Tried to reinstall unity and android module again but even after 2 times of reinstallation I still receive this weird error.

In unity Edit>Preferences>External-Tools>Gradle Installed With Unity is Ticked and marked to the /Tools folder which doesn't even exists

(there is also a warning below that saying I'm missing the recommended Gradle and I should install the recommended version using unity hub. but I already tried reinstalling everything)

I have used the unity android build before and it was always fine, perhaps this happens with the 2021.3.6f version that was released this week.

Can't find any solution to this anywhere, hope you can help.

2 Answers

Found the solution. looks like the gradle folder has changed from AndroidPlayer\SDK\Tools to AndroidPlayer\SDK\cmdline-tools but the path still the old one inside Unity preferences. Copy all folders and files inside cmdline-tools, create a new folder called Tools inside AndroidPlayer folder and paste there.

You can consider it as Unity Bug which will be fix in next update.

But for now please do the below workaround to fix this issue.

Go to the below location in the Unity installed folder /Applications/Unity/Hub/Editor/2021.3.6f1/PlaybackEngines/AndroidPlayer/SDK/cmdline-tools/2.1

Now copy all the files and folders in this folder

enter image description here

Now Go back to the AndroidPlayer folder and create a folder Tools

Now paste copied files/folders in it and click on build and run.

enter image description here

Hope it will fix this issue.

Related