Skip to content

[Bug] Gradle build fails on Unity 2021 when custom gradle templates are enabled #1205

Open
@kashif789us

Description

@kashif789us

[REQUIRED] Please fill in the following fields:

  • Unity editor version: 2021.2.6f1
  • Firebase Unity SDK version: 8.6.2
  • Source you installed the SDK: .unitypackage
  • Problematic Firebase Component: Analytics
  • Other Firebase Components in use: None
  • Additional SDKs you are using: Facebook, None
  • Platform you are using the Unity editor on: Mac
  • Platform you are targeting: Android
  • Scripting Runtime: IL2CPP

[REQUIRED] Please describe the issue here:

My APK fails during building gradle with following error:

CommandInvokationFailure: Gradle build failed.
/Applications/Unity/Hub/Editor/2021.2.6f1/PlaybackEngines/AndroidPlayer/OpenJDK/bin/java -classpath "/Applications/Unity/Hub/Editor/2021.2.6f1/PlaybackEngines/AndroidPlayer/Tools/gradle/lib/gradle-launcher-6.1.1.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "assembleRelease"

stderr[
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8

FAILURE: Build failed with an exception.

  • What went wrong:
    Could not determine the dependencies of task ':unityLibrary:compileReleaseAidl'.

Could not resolve all task dependencies for configuration ':unityLibrary:releaseCompileClasspath'.
Could not find com.google.firebase:firebase-analytics-unity:8.6.2.
Required by:
project :unityLibrary
Could not find com.google.firebase:firebase-app-unity:8.6.2.
Required by:
project :unityLibrary

Steps to reproduce:

Have you been able to reproduce this issue with just the Firebase Unity quickstarts (this GitHub project)?
What's the issue repro rate?

Yes, 100% when I enable mainTemplate.gradle and disable Auto Resolution in Android Resolver Settings.

What happened? How can we make the problem occur?

  1. Run Analaytics Quick start in Unity 2021.2.6f1.
  2. Enable mainTemplate.gradle, launcherTemplate.gradle, baseProjectTemplate.gradle and gradleTemplate.properties
  3. Build APK.

It builds fine If I don't enable gradle scripts and enable Auto Resolution.
It is also building without any problem on older Unity versions with custom gradle files.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions