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] Gradle Build Failure on Unity 2022.3.57f1 #731

Open
jkorn2324 opened this issue Feb 12, 2025 · 7 comments
Open

[Bug] Gradle Build Failure on Unity 2022.3.57f1 #731

jkorn2324 opened this issue Feb 12, 2025 · 7 comments

Comments

@jkorn2324
Copy link

jkorn2324 commented Feb 12, 2025

Please fill in the following fields:

  • Unity editor version: 2022.3.57f1
  • External Dependency Manager version: 1.2.183
  • Source you installed EDM4U: Unity Package Manager via an Extracted Tarball
  • Features in External Dependency Manager in use: Android Resolver, iOS Resolver
  • Plugins SDK in use: Firebase 12.5.0 (Analytics, Messaging, App, Auth, Firestore)
  • Platform you are using the Unity editor on: Windows 11

Please describe the issue here:

What is the issue?
Gradle Fails to build the Unity Project to Android (API 34 & 35) after upgrading the following packages:

  • Unity from 2022.3.20f1 to 2022.3.57f1
  • EDM4U from 1.2.181 to 1.2.183
  • Firebase from 12.1.0 to 12.5.0

How do you reproduce the issue?
Step 1: Set up Project

  • Create a new Unity Project using 2022.3.57f1
  • Download & Install the Packages
  • Download EDM4U 1.2.183 via Tarball
    • Extract tarball as a folder
    • Add to the {UnityProjectPath}/Packages/Google folder
    • Add Package to packages.json
  • Download Firebase (Analytics, Messaging, App, Auth, Firestore) 12.5.0 via Tarball
    • Extract tarball as a folder
    • Add to the {UnityProjectPath}/Packages/Google folder
    • Add Package to packages.json

Step 2: Resolve Project

  • Delete Resolved Libraries (if already there)
  • Press Force Resolve

Step 3: Make Android Build (API Level 34 or 35)

What logs does the build reproduce?
Gradle-error-force-resolve-2022357f1-error.txt [Gradle Log]

Please answer the following, if applicable:

What's the issue repro rate? 100%

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

@jkorn2324 jkorn2324 added new to be triaged type: question labels Feb 12, 2025
@jkorn2324 jkorn2324 changed the title [Bug] Gradle Build Failure on 2022.3.57f1 [Bug] Gradle Build Failure on Unity 2022.3.57f1 Feb 12, 2025
@argzdev argzdev removed the new to be triaged label Feb 12, 2025
@jkorn2324
Copy link
Author

jkorn2324 commented Feb 18, 2025

Hello! Wanted to provide some updates on my end.

I don't think that this is an issue with specifically this version of Firebase - I did some more digging & found that this error persists across different versions. Here is my results:

  • Test 1:
    • Upgrade to latest version of Firebase (12.6.0) & EDM4U (1.2.185)
    • Build on MacOS (Silicon) to Android (to Apk)
    • Result: Still got the same Gradle error
  • Test 2:
    • Downgrade to Firebase 12.4.1 & EDM4U 1.2.183
    • Build on MacOS (Silicon) to Android (to Apk)
    • Result: Still got the same Gradle Error

Has the team looked at the error yet? Also is there any additional context that may help? Thanks!

@argzdev
Copy link
Collaborator

argzdev commented Feb 18, 2025

Hey @jkorn2324, thanks for providing complete details. I tested our Firebase Unity quickstart with all the products you've listed: Analytics, Messaging, App, Auth, Firestore but so far I wasn't able to reproduce the same behavior.

Looking at the stacktrace you've provided, there's 3 errors:

1: Execution failed for task ':launcher:checkReleaseDuplicateClasses'.
2: java.lang.StackOverflowError (no error message)
3: Execution failed for task ':unityLibrary:generateReleaseRFile'.

There's a thread in the Unity forum that listed down quite a few solutions that could help with the error of checkReleaseDuplicateClasses. Could you try Assets → Play Services Resolver → Android Resolver → Delete Resolved Libraries and see if that changes anything?

As for the other errors, these could be consequential errors from the initial error checkReleaseDuplicateClasses.

Let me know what happens. Thanks!

@argzdev argzdev added the needs-info Need information for the developer label Feb 18, 2025
@jkorn2324
Copy link
Author

jkorn2324 commented Feb 18, 2025

Hey thanks for getting back to me!
Just tried it out & here is what I did when using EDM4U 1.2.183 & Firebase 12.5.0:

  • Close Unity, Delete Library Folder, & Re-Open
  • Clicked Assets -> External Dependency Manager -> Android -> Delete Resolved Libraries:
    • Deletes Assets/GeneratedLocalRepo Folder
    • Modifies mainTemplate.gradle & settingsTemplate.gradle (deleting Dependencies)
  • Made an Apk Build
    • Build was successful, however when I ran it I get a dllnotfound exception for Firebase

I mainly get these errors after I run Assets -> External Dependency Manager -> Android -> Force Resolve. However, when I ran this using EDM4U in 1.2.181 & Firebase 12.1.0 on Unity 2022.3.20f1 I was able to successfully build & run the apk without the dllnotfound exception. Is there anything that I'm missing?

Also I wanted to ask if you were installing Firebase & EDM4U directly into the Assets folder using a .unitypackage or by installing each product into the Packages folder using an unzipped .tgz file?

@google-oss-bot google-oss-bot added needs-attention Need Googler's attention and removed needs-info Need information for the developer labels Feb 18, 2025
@argzdev
Copy link
Collaborator

argzdev commented Feb 19, 2025

Thanks for the extra details, @jkorn2324. It looks like the issue isn't present on Android 14 devices or lower. I was able to reproduce the error when testing on Android 15 emulator. Might be an issue similar to firebase/firebase-unity-sdk#1180.

In my case, the app opens for a short while, then crashes after a few seconds.

Stacktrace of the error:

2025/02/19 21:44:04.130 3288 3443 Info Unity Firebase.Auth.AuthUtilPINVOKE:FirebaseAuth_GetAuthInternal(HandleRef, Int32&)
2025/02/19 21:44:04.130 3288 3443 Info Unity Firebase.Auth.FirebaseAuth:GetAuthInternal(FirebaseApp, InitResult&)
2025/02/19 21:44:04.130 3288 3443 Info Unity Firebase.Auth.<>c__DisplayClass18_1:<GetAuth>b__0()
2025/02/19 21:44:04.130 3288 3443 Info Unity Firebase.FirebaseApp:TranslateDllNotFoundException(Action)
2025/02/19 21:44:04.130 3288 3443 Info Unity Firebase.Auth.FirebaseAuth:GetAuth(FirebaseApp)
2025/02/19 21:44:04.130 3288 3443 Info Unity Firebase.Sample.Auth.UIHandler:InitializeFirebase()
2025/02/19 21:44:04.130 3288 3443 Info Unity Firebase.Extensions.<>c__DisplayClass4_1`1:<ContinueWithOnMainThread>b__1()
2025/02/19 21:44:04.130 3288 3443 Info Unity Firebase.<>c__DisplayClass5_0`1:<RunAsync>b__0()
2025/02/19 21:44:04.130 3288 3443 Info Unity Firebase.ExceptionAggregator:Wrap(Action)
2025/02/19 21:44:04.130 3288 3443 Info Unity Firebase.Dispatcher:PollJobs()
2025/02/19 21:44:04.130 3288 3443 Info Unity Firebase.Platform.FirebaseHandler:Update()

Also I wanted to ask if you were installing Firebase & EDM4U directly into the Assets folder using a .unitypackage or by installing each product into the Packages folder using an unzipped .tgz file

On either option, using .unitypackage or .tgz files both works when testing on Android 14. Both option also fails when testing on Android 15.

I'll bring this up to our engineers and see what we can do here.

@argzdev argzdev added type: bug and removed needs-attention Need Googler's attention labels Feb 19, 2025
@jkorn2324
Copy link
Author

Okay that sounds great thanks for investigating the .dllnotfound exception. Keep me posted on what your team finds!

@jkorn2324
Copy link
Author

Okay, I did even more digging and have some more updates:

  • I found the issue with why I was getting the checkReleaseDuplicates gradle errors:
    • Whenever I run Assets -> External Dependency Manager -> Android -> Force Resolve, the settingsTemplate.gradle file wouldn't update the maven paths to the directories where the .aar files are located:
      • Maven directories would be set to url = (unityProjectPath + "/Packages/Google/{path_to_m2repository}") (where the .srcaar files are)
      • The Maven directories should be set to url = (unityProjectPath + "/Assets/GeneratedLocalRepo/{path_to_m2repository}") (where the .aar files are)
    • The checkReleaseDuplicates task would fail because the dependencies wouldn't be found in the maven directories.

On EDM4U 1.2.181, it would set the directory root to match the Assets/GeneratedLocalRepo even with the way my project was set up. I believe that it's due to a change with how Force Resolve works.

The fix ideally would be that if users ran Force Resolve and EDM4U successfully placed the .aar files into the Assets/GeneratedLocalRepo folder. the settingsTemplate.gradle file would be updated so that the maven directories match: url = (unityProjectPath + "/Assets/GeneratedLocalRepo/{path_to_m2repository}"), no matter where the original Firebase packages were located in Unity.

For the .dllnotfoundexception, I haven't looked into that yet either as I built with Android 14. Do you have any updates on that?
Also what are your thoughts on the issue & potential solution to the checkReleaseDuplicates gradle error?

@jkorn2324
Copy link
Author

Hey @argzdev! Just checking in - wanted to ask do or your team have any updates related to this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants