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

Build for Android fails after Updating Unity version and Target API to 34 #519

Open
SMahdiFaghih opened this issue Sep 15, 2024 · 5 comments
Labels
bug Something isn't working investigating We are investigating the current problem new

Comments

@SMahdiFaghih
Copy link

Describe the bug & problem
After updating my Target API to 34 (Android 14) and also updating Unity version to 2021.3.42f1, now i have problem building the game for Android. Before doint so, the build worked correctly on version 2.3.8 but after that it raised the following error. Also updating to 2.3.9 did not help.

After these updates the dependencies inside mainTemplate.gradle should be moved to settingsTemplate.gradle and the error occurs on hmsBaseProjectTemplate.gradle line 7 as follows:

What went wrong:
A problem occurred evaluating script.

Cannot change dependencies of dependency configuration ':classpath' after it has been resolved.

Since this file is generated on build, modifing it won't help. Moving this classpath depencency to mainTemplate.gradle also did not help. The dependency does nto resolve by External Dependency Manager on Force Resolve.

At this point, i don't know what the solution might be and i need your help yo fix this problem.

Environment (please complete the following information):

  • Unity Version 2021.3.42f1
  • HMS Unity Plugin Version 2.3.8 and 2.3.9
Copy link

Thank you for reporting this issue/advice.

We will get back to you as soon as possible.
Would you like to star our plugin to support us? ✨

@github-actions github-actions bot added the new label Sep 15, 2024
@PromanSEW
Copy link

I also affected this problem

@Aziz-T
Copy link
Collaborator

Aziz-T commented Oct 17, 2024

Hi @SMahdiFaghih @PromanSEW

After upgrading the Target API to 34 (Android 14) and updating Unity to version 2021.3.42f1, you encountered an issue during the build process. The error appears on line 7 of hmsBaseProjectTemplate.gradle, with the following message:

"Cannot change dependencies of dependency configuration '
' after it has been resolved."

This error arises because, as of this update, dependencies that were previously placed in mainTemplate.gradle now need to be moved to settingsTemplate.gradle. Despite trying to resolve the issue by updating to HMS Unity Plugin versions 2.3.8 and 2.3.9, the problem persists. Manual changes to the generated hmsBaseProjectTemplate.gradle file have not helped, and neither has forcing the resolution through the External Dependency Manager.

Possible Cause: The issue seems to stem from a mismatch between the way dependency configurations are handled in Unity 2021.3.x versions and the latest Android API requirements. Specifically, modifications to dependency configurations after their resolution can lead to this build error. This may occur due to changes in how Unity generates and processes Gradle files in the context of Android builds, especially for newer Android API levels.

Recommendation: We suggest upgrading to a newer version of Unity beyond 2021.3.42f1, as this version may not fully support the latest Android build system requirements for API 34 (Android 14). Unity versions closer to 2022.x or beyond may offer better compatibility with updated Android APIs and resolve the dependency handling issue. Ensure that your HMS Unity Plugin is also updated accordingly to maintain compatibility.

Steps to Try:

Upgrade Unity to the latest Long Term Support (LTS) version beyond 2021.3.42f1, as newer versions may have addressed this dependency resolution issue.
Ensure all templates (mainTemplate, settingsTemplate) are properly configured after the Unity update.

Please let us know if upgrading Unity resolves the issue, or if further assistance is required.

@PromanSEW
Copy link

@Aziz-T I tried to build in 2021.3.44f1 (latest), and error is still here

@Aziz-T Aziz-T added bug Something isn't working investigating We are investigating the current problem labels Oct 18, 2024
@PromanSEW
Copy link

2021.3.45f1 - the same error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working investigating We are investigating the current problem new
Projects
None yet
Development

No branches or pull requests

3 participants