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

Time:07-14

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>

CodePudding user response:

Apparently there is a problem in 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 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 changed in the build settings.

CodePudding user response:

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

  • Related