Unity Gradle模板丢失(2021.3.6F)
我使用Unity Hub安装了Unity 2021.3.6F,并使用Android Build Support(NDK和SKD)安装了Unity。
进入一个项目并试图在Android平台上构建它,我得到了这个错误:
filenotfoundException:找不到$ c:/programfiles/unity/hub/editor/2021.3.6f1/editor/editor/data/playbackengines/androidplayer/androidplayer/tools \ gradletemplates \ gradletemplates \ aertemplate.gradle.gradle.gradle
in Directory,我甚至没有/内部 /AndroidPlayer内部的工具文件夹。 试图再次重新安装Unity和Android模块,但是即使恢复了2次,我仍然会收到这个奇怪的错误。
在Unity编辑中>首选项>外部工具>以Unity安装的gradle被打勾并标记在甚至不存在的 /工具文件夹中
(下面还有一个警告说我缺少推荐的gradle,我应该安装该文件夹推荐的版本使用Unity Hub,但我已经尝试重新安装所有内容)
我以前使用过Unity Android build,这总是可以的本周发行。
在任何地方都找不到任何解决方案,希望您能提供帮助。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
找到了解决方案。
看起来Gradle文件夹已经从AndroidPlayer \ SDK \工具变为AndroidPlayer \ sdk \ cmdline-tools,但路径仍然是旧的统一偏好。
复制CMDline-Tools内部的所有文件夹和文件,在AndroidPlayer文件夹中创建一个名为“工具”的新文件夹,然后在此处粘贴。
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.
您可以将其视为Unity错误,将在下一个更新中进行修复。
但是现在,请进行以下解决方法以解决此问题。
转到Unity已安装文件夹中的以下位置
/applications/unity/hub/editor/2021.3.6f1/playbackengens/androidplayer/sdk/cmdline-tools/2.1
复制此文件夹中的所有文件和文件夹
现在 href =“ https://i.sstatic.net/zjiqz.png” rel =“ nofollow noreferrer“>
现在返回到AndroidPlayer文件夹并创建文件夹 strong>工具
现在粘贴了复制的文件/文件夹,然后单击“构建”和“运行”。
希望它可以解决此问题。
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
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.
Hope it will fix this issue.