Skip to content

[Bug] Android build fails if Kotlin files included in project #847

Open
@allan-o3h

Description

@allan-o3h

[REQUIRED] Please fill in the following fields:

  • Unity editor version: 2021.3.29f1
  • Firebase Unity SDK version: 11.4.0
  • Source you installed the SDK: Unity Package Manager
  • Problematic Firebase Component: Base App
  • Other Firebase Components in use: NA
  • Additional SDKs you are using: A single .kt file
  • Platform you are using the Unity editor on: Mac
  • Platform you are targeting: Android
  • Scripting Runtime: IL2CPP
  • Pre-built SDK from the website or open-source from this repo: pre-built

[REQUIRED] Please describe the issue here:

If any kotlin files are included in the Unity project the generated gradle project fails to build with incompatible Kotlin metadata issues.

Example project containing a single empty kotlin class attached:

FirebaseBuildError.zip

Produces the following errors when built for Android:

e: /Users/allanbush/.gradle/caches/modules-2/files-2.1/androidx.annotation/annotation/1.5.0/857678d6b4ca7b28571ef7935c668bdb57e15027/annotation-1.5.0.jar!/META-INF/annotation.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.7.1, expected version is 1.4.2.
e: /Users/allanbush/.gradle/caches/transforms-2/files-2.1/3bace5d5f9a6e271a107a0b9ac931c14/jetified-kotlin-stdlib-1.7.10.jar!/META-INF/kotlin-stdlib.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.7.1, expected version is 1.4.2.
e: /Users/allanbush/.gradle/caches/transforms-2/files-2.1/7d85e3ac41f13fcbd1d0187ffb3f07f1/jetified-kotlin-stdlib-common-1.7.10.jar!/META-INF/kotlin-stdlib-common.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.7.1, expected version is 1.4.2.

Full log: Editor.log.zip

Removing either the NativeCode directory or the com.google.firebase.app entry from the package manifest resolves the issue and the build works as expected. But having both of these together results in the build failure.

This issue was not observed with version 9.6.0 of the firebase libraries.

Steps to reproduce:

  1. Unzip the attached project
  2. Replace the 0 byte files in the GooglePackages folder with the proper files: https://dl.google.com/games/registry/unity/com.google.firebase.app/com.google.firebase.app-11.4.0.tgz and https://dl.google.com/games/registry/unity/com.google.external-dependency-manager/com.google.external-dependency-manager-1.2.177.tgz
  3. Open the project, targeting an Android build
  4. Resolve the external dependencies: Assets->External Dependency Manager->Android Resolver->Resolve
  5. Build and run

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