Skip to content

[Bug] Unable to build for Android with Firebase Messaging 8.10.0 and mainTemplate.gradle enabled #1264

@epsmarkh

Description

@epsmarkh

[REQUIRED] Please fill in the following fields:

  • Unity editor version: 2019.4.36f1 and 2021.3.1f1
  • Firebase Unity SDK version: 8.10.0
  • Source you installed the SDK: Unity Package Manager (.unitypackage or Unity Package Manager)
  • Problematic Firebase Component: Messaging (Auth, Database, etc.)
  • Other Firebase Components in use: N/A (Auth, Database, etc.)
  • Additional SDKs you are using: N/A (Facebook, AdMob, etc.)
  • Platform you are using the Unity editor on: Windows (Mac, Windows, or Linux)
  • Platform you are targeting: Android (iOS, Android, and/or desktop)
  • Scripting Runtime: IL2CPP (Mono, and/or IL2CPP)

[REQUIRED] Please describe the issue here:

Android APK target will not build when mainTemplater.gradle is enabled. An error occurs as follows:
Execution failed for task ':unityLibrary:javaPreCompileRelease'.

Could not resolve all files for configuration ':unityLibrary:releaseCompileClasspath'.
Failed to transform artifact 'firebase-messaging-unity.aar (com.google.firebase:firebase-messaging-unity:8.10.0)' to match attributes {artifactType=android-classes, org.gradle.usage=java-api}.
Execution failed for AarToClassTransform: C:\Users\markh.gradle\caches\transforms-2\files-2.1\b76ce627835d0dc8b253dc4e61aeff9a\jetified-firebase-messaging-unity-8.10.0.aar.
Package '${applicationId}' from AndroidManifest.xml is not a valid Java package name as '${applicationId}' is not a valid Java identifier.

With it disabled, APK builds fine.

I suspect it is due to the change to the AndroidManifest.xml contained in the Messaging library. It used to have an explicit package name but now uses ${applicationId}' and is not being replaced when use as a tgz import from Unity Package Manager.

Steps to reproduce:

Open the quick start messaging example. Import the dependency manager, firebase app and firebase messaging from tgz. Switch to Android platform. Enable mainTemplate.gradle in player settings and attempt a build. The build will fail

Have you been able to reproduce this issue with just the Firebase Unity quickstarts (this GitHub project)?
Yes
What's the issue repro rate? (eg 100%, 1/5 etc)
100%

What happened? How can we make the problem occur?
APK will not build. You can recreate it just by switching to the Android platform and building.
This could be a description, log/console output, etc.

If you have a downloadable sample project that reproduces the bug you're reporting, you will
likely receive a faster response on your issue.

Relevant Code:

N/A no code is required. Simply import the packages and build the sample.

Sample with relevant packages attached

testapp.zip

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