Skip to content
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

[Bug] Failing to copy libraries with Unity 2022 and maintemplate enabled #1272

Open
epsmarkh opened this issue May 12, 2022 · 14 comments
Open
Labels
type: bug unity-editor Issues related to Firebase usage in Unity editor

Comments

@epsmarkh
Copy link

epsmarkh commented May 12, 2022

[REQUIRED] Please fill in the following fields:

  • Unity editor version: 2022.1.0f1
  • Firebase Unity SDK version: 8.10.1
  • Source you installed the SDK: tried both .unitypackage and Unity Package Manager
  • Problematic Firebase Component: All
  • Other Firebase Components in use: N/A
  • Additional SDKs you are using: None
  • Platform you are using the Unity editor on: Windows
  • Platform you are targeting: Android
  • Scripting Runtime: IL2CPP

[REQUIRED] Please describe the issue here:

When maintemplate.gradle is enabled and any firebase package is imported, the dependency manager fails to copy the files to the correct location in GeneratedLocalRepo. Builds and Force Resolve both fail with the error:

Unable to copy Assets\Firebase\m2repository\com\google\firebase\firebase-analytics-unity\8.10.1\firebase-analytics-unity-8.10.1.srcaar to Assets\GeneratedLocalRepo\Firebase\m2repository\com\google\firebase\firebase-analytics-unity\8.10.1\firebase-analytics-unity-8.10.1.aar. Assets\GeneratedLocalRepo\Firebase\m2repository\com\google\firebase\firebase-analytics-unity\8.10.1\firebase-analytics-unity-8.10.1.aar will not be included in Gradle builds. Reason: Failed to copy Assets\Firebase\m2repository\com\google\firebase\firebase-analytics-unity\8.10.1\firebase-analytics-unity-8.10.1.srcaar to Assets\GeneratedLocalRepo\Firebase\m2repository\com\google\firebase\firebase-analytics-unity\8.10.1\firebase-analytics-unity-8.10.1.aar due to System.IO.DirectoryNotFoundException: Could not find a part of the path 'D:\unity\Projects\testu22\Assets\GeneratedLocalRepo\Firebase\m2repository\com\google\firebase\firebase-analytics-unity\8.10.1\firebase-analytics-unity-8.10.1.aar'.

When browsing the directory, it has been incorrectly created as
Assets\GeneratedLocalRepo\Firebase\m2repository\com\google\firebase\firebase-analytics-unity\8

instead of

Assets\GeneratedLocalRepo\Firebase\m2repository\com\google\firebase\firebase-analytics-unity\8.10.1

Steps to reproduce:

Have you been able to reproduce this issue with just the Firebase Unity quickstarts (this GitHub project)?

Yes, it also happens with an empty project with just maintemplate.gradle enabled and any firebase package imported

What's the issue repro rate? (eg 100%, 1/5 etc)

100%

What happened? How can we make the problem occur?

Create a project, switch to Android, enable maintemplate.gradle and import any firebase package. When attempting to build or use the EDM force resolve option, errors are shown and the build fails.

If you have a downloadable sample project that reproduces the bug you're reporting, you will
likely receive a faster response on your issue.

Relevant Code:

N/A

@paulinon paulinon added unity-editor Issues related to Firebase usage in Unity editor and removed new New issue. api: auth labels May 12, 2022
@paulinon
Copy link
Contributor

Hi @epsmarkh,

Thanks for letting us know about this. I've used the same versions of the Unity editor and the Firebase SDK, and I am facing this issue on my end.

I'll be marking this as a bug for now. You may refer to this thread for updates.

@hjupter
Copy link

hjupter commented Jun 9, 2022

I'm having the same problem on Mac with Apple Silicon

@dreamcodestudio
Copy link

dreamcodestudio commented Jul 4, 2022

the same problem
Unity 2022.1.4f1
packages:
external-dependency-manager 1.2.171
GooglePlayGamesPlugin v0.11.01
Firebase Unity 9.1.0

@DeniMN
Copy link

DeniMN commented Jul 23, 2022

has anyone solved this problem?

@dreamcodestudio
Copy link

has anyone solved this problem?

for us it's work only with disabled mainTemplate in Unity Player Settings

@DeniMN
Copy link

DeniMN commented Jul 23, 2022

has anyone solved this problem?

for us it's work only with disabled mainTemplate in Unity Player Settings

Thanks

@CheeryLee
Copy link

❗ Finally I found the reason why it's happening. There is a Unity bug, it's already registered, thus it's not related to Firebase at all: https://issuetracker.unity3d.com/issues/folder-name-is-truncated-when-dot-is-used-in-the-name

Be more concretically, you can find this code in FileUtils class that is part of AndroidResolver project: https://github.com/googlesamples/unity-jar-resolver/blob/master/source/VersionHandlerImpl/src/FileUtils.cs#L635

When recursion goes to dotted part of the path (8.10.1 in your case), CreateFolder method returns an error.

To solve the problem you can do one of the following things:

  1. use explicit resolving as described before: libraries stay in Plugins folder;
  2. downgrade to Unity version where the issue doesn't reproduce (can't imagine that someone will do this 😆 );
  3. replace the whole code of CreateFolder method with native Directory.CreateDirectory (requires manual resolver compiling).

@jonesjacky
Copy link

Simple yet Annoying Bug.

Found a simple solution :

No need to disable anything.

It simply cannot find/create the folder with the same version number in Generated Local Repo Directory if created through Unity Asset Browser.

  1. Simply go to the directory through Windows Explorer and in my case it was "[THE LOCATION OF YOUR GAME PROJECT]\Assets\GeneratedLocalRepo\Firebase\m2repository\com\google\firebase\firebase-analytics-unity".
    Or
    In Unity Asset Browser, browse to "Assets\GeneratedLocalRepo\Firebase\m2repository\com\google\firebase\firebase-analytics-unity\firebase-analytics-unity" and right-click, then "Show in Explorer".

  2. Delete any existing folder and refresh in unity asset browser

  3. Create a new folder with version number, mine was 9.3.0 and check inside unity if the folder has been synchronized. Only a folder with your corresponding version number should exist.

  4. Do the same for all firebase folders, and then run Force resolve.

Voila!! Android Dependencies have been resolved.

@dreamcodestudio
Copy link

dreamcodestudio commented Aug 3, 2022

Simple yet Annoying Bug.

Found a simple solution :

No need to disable anything.

It simply cannot find/create the folder with the same version number in Generated Local Repo Directory if created through Unity Asset Browser.

  1. Simply go to the directory through Windows Explorer and in my case it was "[THE LOCATION OF YOUR GAME PROJECT]\Assets\GeneratedLocalRepo\Firebase\m2repository\com\google\firebase\firebase-analytics-unity".
    Or
    In Unity Asset Browser, browse to "Assets\GeneratedLocalRepo\Firebase\m2repository\com\google\firebase\firebase-analytics-unity\firebase-analytics-unity" and right-click, then "Show in Explorer".
  2. Delete any existing folder and refresh in unity asset browser
  3. Create a new folder with version number, mine was 9.3.0 and check inside unity if the folder has been synchronized. Only a folder with your corresponding version number should exist.
  4. Do the same for all firebase folders, and then run Force resolve.

Voila!! Android Dependencies have been resolved.

it's simple, but it's not work if you frequencly updated plugins, we need worked, not 🔧"magical" solution
It seems only like temp solution

@jonesjacky
Copy link

it's simple, but it's not work if you frequencly updated plugins, we need worked, not 🔧"magical" solution It seems only like temp solution

Of course, its a temporary solution. Its for the devs to fix it permanently as it is present in many versions of the editor, and I prefer not to touch the mess that the devs created, so hence my solution which hardly takes some time even if we add a couple different versions.

@vangogih
Copy link

Hey, @chkuang-g has already created PR-543 and after some time it will be merged to the unity-jar-resolver repo.

@sercanaydemir
Copy link

Simple yet Annoying Bug.

Found a simple solution :

No need to disable anything.

It simply cannot find/create the folder with the same version number in Generated Local Repo Directory if created through Unity Asset Browser.

  1. Simply go to the directory through Windows Explorer and in my case it was "[THE LOCATION OF YOUR GAME PROJECT]\Assets\GeneratedLocalRepo\Firebase\m2repository\com\google\firebase\firebase-analytics-unity".
    Or
    In Unity Asset Browser, browse to "Assets\GeneratedLocalRepo\Firebase\m2repository\com\google\firebase\firebase-analytics-unity\firebase-analytics-unity" and right-click, then "Show in Explorer".
  2. Delete any existing folder and refresh in unity asset browser
  3. Create a new folder with version number, mine was 9.3.0 and check inside unity if the folder has been synchronized. Only a folder with your corresponding version number should exist.
  4. Do the same for all firebase folders, and then run Force resolve.

Voila!! Android Dependencies have been resolved.

that's worked, thank you!!

@dreamcodestudio
Copy link

@Zarkend
Copy link

Zarkend commented Dec 7, 2022

for us it's work only with disabled mainTemplate in Unity Player Settings

Thanks it solved it for me too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug unity-editor Issues related to Firebase usage in Unity editor
Projects
None yet
Development

No branches or pull requests