Skip to content

[Bug][Android] Build failure after 2021.3.41f1 (AGP updated from 4.2.2 to 7.4.2) #699

Closed
@manugildev

Description

@manugildev

[READ] For Firebase Unity SDK issues, please report to Firebase Unity Sample

Once you've read this section and determined that your issue is appropriate for this repository, please delete this section.

[REQUIRED] Please fill in the following fields:

  • Unity editor version: 2021.3.41f1
  • External Dependency Manager version: 1.2.178
  • Source you installed EDM4U: .unitypackage
  • Features in External Dependency Manager in use: Android Resolver
  • Plugins SDK in use: Firebase 12.1.0
  • Platform you are using the Unity editor on: Mac

[REQUIRED] Please describe the issue here:

Please answer the following, if applicable:

What's the issue repro rate? 100%

What happened? How can we make the problem occur?
.apk doesn't build because of gradle failures.

FAILURE: Build completed with 3 failures.

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':launcher:checkReleaseDuplicateClasses'.
> Could not resolve all files for configuration ':launcher:releaseRuntimeClasspath'.
   > Could not find com.google.firebase:firebase-analytics-unity:12.1.0.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/google/firebase/firebase-analytics-unity/12.1.0/firebase-analytics-unity-12.1.0.pom
       - https://repo.maven.apache.org/maven2/com/google/firebase/firebase-analytics-unity/12.1.0/firebase-analytics-unity-12.1.0.pom
       - file:/Users/manuel.gil/Downloads/Unity/firebase/New Unity Project/Library/Bee/Android/Prj/Mono2x/Gradle/unityLibrary/libs/firebase-analytics-unity-12.1.0.jar
       - file:/Users/manuel.gil/Downloads/Unity/firebase/New Unity Project/Library/Bee/Android/Prj/Mono2x/Gradle/unityLibrary/libs/firebase-analytics-unity.jar
     Required by:
         project :launcher > project :unityLibrary
   > Could not find com.google.firebase:firebase-app-unity:12.1.0.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/google/firebase/firebase-app-unity/12.1.0/firebase-app-unity-12.1.0.pom
       - https://repo.maven.apache.org/maven2/com/google/firebase/firebase-app-unity/12.1.0/firebase-app-unity-12.1.0.pom
       - file:/Users/manuel.gil/Downloads/Unity/firebase/New Unity Project/Library/Bee/Android/Prj/Mono2x/Gradle/unityLibrary/libs/firebase-app-unity-12.1.0.jar
       - file:/Users/manuel.gil/Downloads/Unity/firebase/New Unity Project/Library/Bee/Android/Prj/Mono2x/Gradle/unityLibrary/libs/firebase-app-unity.jar
     Required by:
         project :launcher > project :unityLibrary
     ...

Unity updated Gradle from 6.7.1 to 7.5.1 and AGP from 4.2.2 to 7.1.2 in 2021.3.41f1. This is the root cause of the issue. For Gradle 7+ the plugin repositories need to be added to settingsTemplate.gradle, not to mainTemplate.gradle.

This condition in GradleTemplateResolver.cs needs to be updated to also include versions >= than 2021.3.41f1.

return Google.VersionHandler.GetUnityVersionMajorMinor() >= 2022.2f;

An even better way of handling it would be to base that condition in the AGP version, instead of Unity version, and make it return true when AGP >= 7.0.0.

More Info

→ See initial report on the Unity forums.
→ Reprodution project: failing_edm4u_2021_3_41f1.zip

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions