7

I'm trying to setup Firebase notifications. I did changes in app level and root level build.gradle. But still, its giving me error in Manifest for MyFirebaseMessagingService. Error is Unresolved Class.

<?xml version="1.0" encoding="utf-8"?>

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
    <activity android:name=".MainActivity">


        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <action android:name="com.google.firebase.MESSAGING_EVENT"/>
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity android:name=".s" />
    <activity android:name=".im" />
    <activity android:name=".Main2Activity" />
    <activity android:name=".sactivity" />
    <service
        android:name=".MyFirebaseMessagingService">
        <intent-filter>
            <action android:name="com.google.firebase.MESSAGING_EVENT"/>
        </intent-filter>
    </service>
    <activity
        android:name=".ScrollingActivity"
        android:label="@string/title_activity_scrolling"
        android:theme="@style/AppTheme.NoActionBar"></activity>
</application>

coolamz
  • 377
  • 2
  • 3
  • 11
  • 1
    Is MyFirebaseMessaginService actually a class? – Ali Bdeir Sep 24 '16 at 15:31
  • 1
    Just a tip, upgrade to Android Studio 2.2; when upgraded if you go to Tools>Firebase you can set up any app without having to add any classes or dependencies as it will add it itself. Just go to Tools>Firebase, select notifications from the window that popped up. Then follow everything they say there. – Ali Bdeir Sep 24 '16 at 15:33
  • No. I followed the tutorial on https://firebase.google.com/docs/notifications/android/console-audience – coolamz Sep 24 '16 at 16:31
  • They don't yet include the fact about the Firebase plugin. I suggest upgrading and using it – Ali Bdeir Sep 24 '16 at 18:02
  • @AbAppletic: while I like that you're promoting the new Firebase Assistant in Android Studio 2.2, I have no reason to believe that it'll make difference to this process? Have you seen a case where coolamz's problem occurs that was problem occurs and it was solved with the new assistant? If so, can you share details of that? – Frank van Puffelen Sep 24 '16 at 20:37
  • @FrankvanPuffelen I'm not saying it'll solve his problem as it adds no services, I'm just saying it could save him time next time he's setting up an app with Firebase. – Ali Bdeir Sep 25 '16 at 04:08
  • I recoded the activity and updated to Android Studio 2.2. They've made it very simple. Thanks AbAppletic, Frank van Puffelen and AbAppletic for your support! – coolamz Sep 27 '16 at 16:04

3 Answers3

5

Looks like the Android Manifest file can't locate the MyFirebaseMessagingService class. I'd suggest you to put the fully qualified package name of the class. See example below:

    <service android:name="com.android.notification.MyFirebaseMessagingService">
        <intent-filter>
            <action android:name="com.google.firebase.MESSAGING_EVENT" />
        </intent-filter>
    </service>
looptheloop88
  • 3,026
  • 17
  • 20
0

Oh! you haven't create any java class here, lets just get around it since |service| is instantiated to true on default.You should make android:enabled="false",i think this should work. see detail code below.

<service  android:enabled="false" android:name="MyFirebaseMessagingService">
        <intent-filter>
            <action android:name="com.google.firebase.MESSAGING_EVENT"/>
        </intent-filter>
</service>
devsam247
  • 1,280
  • 13
  • 18
0
  <service android:name="com.fcm.MyFirebaseMessagingServices">
        <intent-filter>
            <action android:name="com.google.firebase.MESSAGING_EVENT" />
        </intent-filter>
    </service>

    <service android:name="com.fcm.MyFirebaseInstanceIdServices">
        <intent-filter>
            <action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
        </intent-filter>
    </service>
Shraddha Patel
  • 149
  • 1
  • 5