Unity error at the export. How can i fix it?

Viewed 1683

In Unity is the following error how can I fix it because I want to export my program: FileNotFoundException: Failed to find $C:/Program Files/Unity/Hub/Editor/2021.3.6f1/Editor/Data/PlaybackEngines/AndroidPlayer/Tools\GradleTemplates\mainTemplate.gradle UnityEditor.Android.AndroidBuildPostprocessor.GetTemplate (System.String toolsPath, System.String fileName) (at <0bc7e9c04c1540528b26863a0cb726ae>

4 Answers

Apparently, there is a problem with the indicated path. In such cases, perhaps it is better to uninstall the android export package and re-download it. To do this go to the file: Files / Unity / Hub / Editor / 2021.3.6f1 / Editor / Data / modules.json. In this file, find the section with the camo id equal to "android" and set the selected field to false. Do the same for the sections with the ids "android-sdk-ndk-tools", "android-sdk-platform-tools", "android-sdk-build-tools" android-sdk-platforms-29 "," android -sdk-platforms-30 "," android-ndk "," android-open-jdk ". Basically, all those are related to Android. Then in the Files / Unity / Hub / Editor / 2021.3.6f1 / Editor / Data / PlaybackEngines folder, delete the Android player. Restart Unity and Unity Hub and from Unity Hub, you will be able to re-download the Android modules. For prevention make a copy of the Files / Unity / Hub / Editor / 2021.3.6f1 / Editor / Data folder and maybe even the project, if something goes wrong ... If the problem continues, it probably means there is some setting change in the build settings.

I tried uninstalling and reinstalling Unity editor 2021.3.6f1 then the Android modules separately and got same error.

I ended up copying the entire missing tool directory from Unity 2021.3.5f1 and then my build worked.

C:\Program Files\Unity\2021.3.5f1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools

to

C:\Program Files\Unity\2021.3.6f1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools

first delete .gradle folder in C:\Users\username

Again build

I am facing this problem now with my first Unity.

I got this error on Build and run to Android.

GradleTemplates was found in C:\Program Files\Unity\Hub\Editor\2021.3.6f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\cmdline-tools\2.1.

So I copied everything to C:/Program Files/Unity/Hub/Editor/2021.3.6f1/Editor/Data/PlaybackEngines/AndroidPlayer/Tools and it worked.

Related