googlesamples / unity-jar-resolver

Unity plugin which resolves Android & iOS dependencies and performs version management
Other
1.21k stars 336 forks source link

[Bug] DirectoryNotFoundException: Unable to copy 'mainTemplate.gradle' from Unity engine folder #674

Open Str4tos opened 4 months ago

Str4tos commented 4 months ago

[REQUIRED] Please fill in the following fields:

[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?

  1. Create new Unity project.
  2. Import EDM4U .unitypackage
  3. Add some Dependencies.xml
  4. Resolve dependencies.
  5. 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)
google-oss-bot commented 4 months ago

This issue does not seem to follow the issue template. Make sure you provide all the required information.

ErnSur commented 3 months ago

I would also like to see it fixed