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

Open
#1,205 14 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
csharp, unity

Research direction

Reproduce the failure with the Analytics Quickstart in Unity 2021.2.6f1, enabling mainTemplate.gradle, launcherTemplate.gradle, baseProjectTemplate.gradle, and gradleTemplate.properties while disabling Auto Resolution. Start by examining the custom Gradle template configuration and the reported missing Firebase dependencies. Done means the Android APK builds successfully in this configuration.

Written by the indexing model from the issue text.

Description

api: analytics type: bug
[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.

Dominant language
C#
Stars
923
Forks
456
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from firebase/quickstart-unity

All issues in firebase/quickstart-unity

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.