firebase / quickstart-unity

Firebase Quickstart Samples for Unity
https://firebase.google.com/games
Apache License 2.0
819 stars 424 forks source link

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

Closed epsmarkh closed 2 years ago

epsmarkh commented 2 years ago

[REQUIRED] Please fill in the following fields:

[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

a-maurice commented 2 years ago

Thanks for flagging this issue, it seems that the Messaging srcaar has a problem with the AndroidManifest within it. We will try to get a fix out. In the meantime, as a workaround you can:

cynthiajoan commented 2 years ago

Fixed in 8.10.1