Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Str4tos opened this issue Feb 22, 2024 · 5 comments

Comments

@Str4tos
Copy link

Str4tos commented Feb 22, 2024

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

  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)

@Str4tos Str4tos added new to be triaged type: question labels Feb 22, 2024
@google-oss-bot
Copy link

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

@paulinon paulinon removed the new to be triaged label Feb 22, 2024
@ErnSur
Copy link

ErnSur commented Mar 29, 2024

I would also like to see it fixed

@Thaina
Copy link

Thaina commented Sep 16, 2024

Is this the same as #697 ?

@argzdev
Copy link
Collaborator

argzdev commented Sep 16, 2024

I wouldn't say it's the same as #697. The linked issue only affects version Unity 6.

@argzdev
Copy link
Collaborator

argzdev commented Sep 27, 2024

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!

@argzdev argzdev closed this as completed Sep 27, 2024
@googlesamples googlesamples locked and limited conversation to collaborators Oct 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants