firebase / firebase-unity-sdk

The Firebase SDK for Unity
http://firebase.google.com
Apache License 2.0
231 stars 38 forks source link

[Question] Cannot find symbol import com.google.firebase.messaging.MessageForwardingService after updating firebase-messaging-unity #1138

Open JiekeZhu opened 2 weeks ago

JiekeZhu commented 2 weeks ago

What is your question?

Cannot find symbol import com.google.firebase.messaging.MessageForwardingService after updating firebase-messaging-unity.

In my jar module, add the MessagingUnityPlayerActivity.java file and the packages needed. There is an error at import com.google.firebase.messaging.MessageForwardingService; Just can't find MessageForwardingService.

Firebase Unity SDK Version

12.4.0

Unity editor version

2022.3.43f1

Installation Method

.unitypackage

Problematic Firebase Component(s)

No response

Other Firebase Component(s) in use

No response

Additional SDKs you are using

Facebook.

Targeted Platform(s)

Apple Platforms, Android

Unity editor platform

Windows

Scripting Runtime

IL2CPP

Release Distribution Type

Pre-built SDK from https://firebase.google.com/download/unity

google-oss-bot commented 2 weeks ago

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

argzdev commented 2 weeks ago

Hey @JiekeZhu, thanks for reaching out. I tried reproducing this behavior but so far I've encountered no issues. Here's what I did:

  1. Open our Firebase Unity Quickstart for Firebase Cloud Messaging
  2. Import Firebase Cloud Messaging version 12.3.0 via Assets > Import Package > Custom Package...
  3. Run app in Android platform (Builds and runs successfully)
  4. Delete Firebase Cloud Messaging via Assets > External Dependency Manager > Version Handler > Uninstall Managed Packages (choose Firebase Cloud Messaging 12.3.0)
  5. Import Firebase Cloud Messaging version 12.4.0 via Assets > Import Package > Custom Package...
  6. Run app in Android platform (Builds and runs successfully)

Not sure if I'm missing anything. Could you specify the steps you took to reproduce this behavior? Thanks!

JiekeZhu commented 2 weeks ago

I follow the steps in this doc, https://firebase.google.com/docs/cloud-messaging/unity/client. At the step, Configuring a custom entry point Activity, I need to modify my CustomActivity.java to extend from com.google.firebase.MessagingUnityPlayerActivity, which will be produced into a sdk.aar package, an Android Studio module. And then I get this error, MessageForwardingService can't be found. I stopped here.

I guess it's because I'm trying to do the work in an aar module and I failed to configure the correct gradle file.

Here's the dependencies. implementation 'com.google.firebase:firebase-analytics:22.1.2' implementation 'com.google.firebase:firebase-app-unity:12.4.0' implementation 'com.google.firebase:firebase-common:21.0.0' implementation 'com.google.firebase:firebase-iid:21.1.0' implementation 'com.google.firebase:firebase-messaging:24.0.3' implementation 'com.google.firebase:firebase-messaging-unity:12.4.0' implementation 'com.google.flatbuffers:flatbuffers-java:1.12.0'

The result is an error in my java file, MessageForwardingService can't be imported.