[Bug] DirectoryNotFoundException: Unable to copy 'mainTemplate.gradle' from Unity engine folder
Str4tos opened this issue · 5 comments
[REQUIRED] Please fill in the following fields:
- Unity editor version: 2021.3.35
- External Dependency Manager version: 1.2.179
- Source you installed EDM4U: .unitypackage (.unitypackage or Unity Package Manager)
- Features in External Dependency Manager in use: Android Resolver (Android Resolver, iOS Resolver, VersionHandler, etc.)
- Plugins SDK in use: Any (Firebase, Admob, Facebook, etc.)
- Platform you are using the Unity editor on: Mac (Mac, Windows, or Linux)
[REQUIRED] Please describe the issue here:
The New Unity projects have no Assets/Plugins/Android
directory by default so copy the mainTemplate.gradle
file fails with DirectoryNotFoundException
.
Certainly, manually creating this path in the project resolves everything.
My goal is to highlight this minor flaw in the automatic creation of directory tree for file copying.
Please answer the following, if applicable:
What's the issue repro rate?
100% for new unity projects.
What happened? How can we make the problem occur?
- Create new Unity project.
- Import EDM4U .unitypackage
- Add some Dependencies.xml
- Resolve dependencies.
- Get error in console.
Error log from console:
Unable to copy 'mainTemplate.gradle' from Unity engine folder '/Users/stratos/Documents/Environment/UnityEditors/2021.3.35f1/PlaybackEngines/AndroidPlayer/Tools/GradleTemplates' to this project folder 'Assets/Plugins/Android'.
System.IO.DirectoryNotFoundException: Could not find a part of the path "/Users/stratos/Documents/Unity/CASTestUnity2021_3/Assets/Plugins/Android/mainTemplate.gradle".
at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x00164] in <37016a4553a741319234725eae02e3ac>:0
at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.IO.FileOptions options) [0x00000] in <37016a4553a741319234725eae02e3ac>:0
at (wrapper remoting-invoke-with-check) System.IO.FileStream..ctor(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare,int,System.IO.FileOptions)
at System.IO.FileSystem.CopyFile (System.String sourceFullPath, System.String destFullPath, System.Boolean overwrite) [0x00035] in <37016a4553a741319234725eae02e3ac>:0
at System.IO.File.Copy (System.String sourceFileName, System.String destFileName, System.Boolean overwrite) [0x00062] in <37016a4553a741319234725eae02e3ac>:0
at System.IO.File.Copy (System.String sourceFileName, System.String destFileName) [0x00000] in <37016a4553a741319234725eae02e3ac>:0
at GooglePlayServices.GradleTemplateResolver.EnsureGradleTemplateEnabled (System.String templateName) [0x00029] in /Users/amaurice/Documents/GitHub/unity-jar-resolver/source/AndroidResolver/src/GradleTemplateResolver.cs:752
UnityEngine.Debug:LogError (object)
Google.Logger:Log (string,Google.LogLevel) (at /Users/amaurice/Documents/GitHub/unity-jar-resolver/source/VersionHandlerImpl/src/Logger.cs:136)
GooglePlayServices.PlayServicesResolver:Log (string,Google.LogLevel) (at /Users/amaurice/Documents/GitHub/unity-jar-resolver/source/AndroidResolver/src/PlayServicesResolver.cs:1077)
GooglePlayServices.GradleTemplateResolver:EnsureGradleTemplateEnabled (string) (at /Users/amaurice/Documents/GitHub/unity-jar-resolver/source/AndroidResolver/src/GradleTemplateResolver.cs:754)
GooglePlayServices.PlayServicesResolver:EnableGradleTemplates () (at /Users/amaurice/Documents/GitHub/unity-jar-resolver/source/AndroidResolver/src/PlayServicesResolver.cs:1773)
GooglePlayServices.PlayServicesResolver:ResolveUnsafeAfterMainTemplateCheck (System.Action`1<bool>,bool,bool,bool) (at /Users/amaurice/Documents/GitHub/unity-jar-resolver/source/AndroidResolver/src/PlayServicesResolver.cs:1806)
GooglePlayServices.PlayServicesResolver/<>c__DisplayClass110_0:<ScheduleResolve>b__1 () (at /Users/amaurice/Documents/GitHub/unity-jar-resolver/source/AndroidResolver/src/PlayServicesResolver.cs:1751)
GooglePlayServices.PlayServicesResolver:ExecuteNextResolveJob () (at /Users/amaurice/Documents/GitHub/unity-jar-resolver/source/AndroidResolver/src/PlayServicesResolver.cs:1598)
GooglePlayServices.PlayServicesResolver:ScheduleResolve (bool,bool,System.Action`1<bool>,bool) (at /Users/amaurice/Documents/GitHub/unity-jar-resolver/source/AndroidResolver/src/PlayServicesResolver.cs:1764)
GooglePlayServices.PlayServicesResolver:AutoResolve (System.Action) (at /Users/amaurice/Documents/GitHub/unity-jar-resolver/source/AndroidResolver/src/PlayServicesResolver.cs:1258)
GooglePlayServices.PlayServicesResolver/<>c:<ScheduleAutoResolve>b__86_1 () (at /Users/amaurice/Documents/GitHub/unity-jar-resolver/source/AndroidResolver/src/PlayServicesResolver.cs:1237)
Google.RunOnMainThread:ExecutePollingJobs () (at /Users/amaurice/Documents/GitHub/unity-jar-resolver/source/VersionHandlerImpl/src/RunOnMainThread.cs:409)
Google.RunOnMainThread/<>c:<ExecuteAllUnnested>b__28_0 () (at /Users/amaurice/Documents/GitHub/unity-jar-resolver/source/VersionHandlerImpl/src/RunOnMainThread.cs:541)
Google.RunOnMainThread:RunAction (System.Action) (at /Users/amaurice/Documents/GitHub/unity-jar-resolver/source/VersionHandlerImpl/src/RunOnMainThread.cs:343)
Google.RunOnMainThread:ExecuteAllUnnested (bool) (at /Users/amaurice/Documents/GitHub/unity-jar-resolver/source/VersionHandlerImpl/src/RunOnMainThread.cs:530)
Google.RunOnMainThread:ExecuteAll () (at /Users/amaurice/Documents/GitHub/unity-jar-resolver/source/VersionHandlerImpl/src/RunOnMainThread.cs:512)
UnityEditor.EditorApplication:Internal_CallUpdateFunctions () (at /Users/bokken/build/output/unity/unity/Editor/Mono/EditorApplication.cs:358)
This issue does not seem to follow the issue template. Make sure you provide all the required information.
I would also like to see it fixed
I wouldn't say it's the same as #697. The linked issue only affects version Unity 6.
Hey folks, this is now resolved in version 1.2.183
. I've tested this out and it seems to work correctly. That said, I'll go ahead and close this thread. Thanks!