Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

myfirebasemessaging service is not assignable to android.app.service

This is my manifest file. I have a problem login in on my app and I am getting this error. my firebase messaging service is not assignable to android.app.service. What might be the problem?

<!-- [START firebase_service] -->
    <service android:name=".MyFirebaseMessagingService">
        <intent-filter>
            <action android:name="com.google.firebase.MESSAGING_EVENT" />
        </intent-filter>
    </service>
    <!-- [END firebase_service] -->
    <!-- [START firebase_iid_service] -->
    <service
        android:name=".MyFirebaseInstanceIDService"
        android:enabled="true"
        android:exported="true">
        <intent-filter>
            <action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
        </intent-filter>
    </service>
like image 437
hushtag Avatar asked Nov 22 '17 13:11

hushtag


4 Answers

I had the same error message in my android studio, and I just updated firebase-messaging lib (com.google.firebase:firebase-messaging) in my build.gradle and the message disappeared. enter image description here

like image 151
Lai Lee Avatar answered Oct 21 '22 15:10

Lai Lee


I had the same exact message. I discovered that in my case the reason for this message was that I was declaring the MyFirebaseInstanceIDService in the following way:

public class MyFirebaseInstanceIDService extends FirebaseMessagingService

where the last class had to be solved by:

import com.google.firebase.messaging.FireBaseMessagingService;

The issue was in the uppercase B in FireBaseMessagingService then I corrected into:

import com.google.firebase.messaging.FirebaseMessagingService;

and the message disappeared

PS: ALT+Enter to automatically solve the imports is definitely the safest way to go

like image 26
Antonino Avatar answered Oct 21 '22 16:10

Antonino


Add This Code in your grade dependencies file and your problem will be resolved


dependencies { implementation 'com.google.firebase:firebase-messaging:17.1.0'}

like image 20
Gaurav Avatar answered Oct 21 '22 15:10

Gaurav


I have the same problem and i have alredy a project with google maps and my main activity is this

public class MapsActivity extends FragmentActivity implements
        OnMapReadyCallback, GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener {

and have

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0-rc01'
    implementation 'com.google.android.gms:play-services-maps:15.0.1'
    implementation 'com.google.android.gms:play-services-location:15.0.1'
    implementation 'com.mcxiaoke.volley:library:1.0.+'
    implementation 'com.google.firebase:firebase-core:16.0.1'
    implementation 'com.google.firebase:firebase-messaging:17.0.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
apply plugin: 'com.google.gms.google-services'

I dont know if i can extend 2 differentes class or should create another class like @Antonino answer

like image 43
Roger Avatar answered Oct 21 '22 16:10

Roger