Why won't the build system find com.google.firebase.messaging?

I am attempting to add Firebase based push notifications to my Xamarin Forms Android app as described in the developer guide on this site (I can't post links here yet).

However, as soon as I extend FirebaseMessagingService, I receive this error: "error: package com.google.firebase.messaging does not exist"

I have added the Xamarin-GooglePlayServices-Base and Xamarin-Firebase-Messaging Nuget packages as described in the tutorial and can see the references in my Visual Studio project. I have downloaded the example project that goes with the tutorial and it builds correctly as does a brand new project I created.

I have struggled with this for several days and am not sure what else I can try to resolve this issue. Any suggestions?

Answers

  • TomasDTomasD Member

    This is the error in visual studio

  • tonholistonholis USMember ✭✭

    Hi @TomasD ,

    I have the same problem here. Did you solve it?

    I'm using the Xamarin.Firebase.Messaging v60.1142.0 (targetFramework="monoandroid80").

    5>obj\Debug\android\src\md50f618280c82a5f89be090d8705f581bc\MyFirebaseMessagingService.java:5: error: package com.google.firebase.messaging does not exist
    5>  extends com.google.firebase.messaging.FirebaseMessagingService
    5>                                       ^
    5>obj\Debug\android\src\md50f618280c82a5f89be090d8705f581bc\MyFirebaseMessagingService.java:27: error: package com.google.firebase.messaging does not exist
    5>  public void onMessageReceived (com.google.firebase.messaging.RemoteMessage p0)
    5>                                                              ^
    5>obj\Debug\android\src\md50f618280c82a5f89be090d8705f581bc\MyFirebaseMessagingService.java:32: error: package com.google.firebase.messaging does not exist
    5>  private native void n_onMessageReceived (com.google.firebase.messaging.RemoteMessage p0);
    5>                                                                        ^
    5>obj\Debug\android\src\md50f618280c82a5f89be090d8705f581bc\MyFirebaseMessagingService.java:22: error: cannot find symbol
    5>      if (getClass () == MyFirebaseMessagingService.class)
    5>          ^
    5>  symbol:   method getClass()
    5>  location: class MyFirebaseMessagingService
    5>Note: Some input files use or override a deprecated API.
    5>Note: Recompile with -Xlint:deprecation for details.
    5>Note: Some input files use unchecked or unsafe operations.
    5>Note: Recompile with -Xlint:unchecked for details.
    5>4 errors
    5> error: package com.google.firebase.messaging does not exist
    5>  extends com.google.firebase.messaging.FirebaseMessagingService
    5>
    5> error: package com.google.firebase.messaging does not exist
    5>  public void onMessageReceived (com.google.firebase.messaging.RemoteMessage p0)
    5>
    5> error: package com.google.firebase.messaging does not exist
    5>  private native void n_onMessageReceived (com.google.firebase.messaging.RemoteMessage p0);
    5>
    5> error: cannot find symbol
    5>      if (getClass () == MyFirebaseMessagingService.class)
    5>  symbol:   method getClass()
    5>  location: class MyFirebaseMessagingService
    5>
    5>Done executing task "Javac" -- FAILED.
    
  • ZaneCampbellZaneCampbell USMember ✭✭
    edited March 2018

    Has anyone resolved this as yet? I have been having this issue for months.

  • Xamarin.Build.Download download this nuget @ZaneCampell @tonholis @TomasD

  • ZaneCampbellZaneCampbell USMember ✭✭

    @gurvinderbinny12 I updated mine a couple days ago and it worked so i can confirm that works.Thank you.

  • eliasribeiroeliasribeiro USMember ✭✭
    edited June 2018

    I installed Xamarin.Build.Download but not working with me. I'm trying to add push notification according to the tutorial https://youtu.be/le2lDY22xwM?t=46m53s. Exactly in this execution (46m53s) presented these errors:

    Packages installed (v60.1142.1):
    Xamarin.Build.Download - v0.4.11.
    Xamarin.Firebase.Messaging
    Xamarin.Firebase.Iid
    Xamarin.Firebase.Common
    Xamarin.GooglePlayServices.Base
    Xamarin.GooglePlayServices.Basement
    Xamarin.GooglePlayServices.Tasks

    Thank for any help.

  • Jeff_SoCalJeff_SoCal USMember ✭✭

    Make sure the Firebase.Messaging using directive is added to the class ex:

    using Firebase.Messaging

    namespace MyNamespace
    {
    [Service]
    [IntentFilter(new[] { "com.google.firebase.MESSAGING_EVENT"})]
    public class MyFirebaseMessaingService : FirebaseMessagingService
    {
    ..

  • EdwardKEdwardK Member

    Same problem here...
    the above solutions did not help;

    but clean project / build did removed this error for me.

Sign In or Register to comment.