hushtag
hushtag

Reputation: 83

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>

Upvotes: 6

Views: 6911

Answers (4)

Lai Lee
Lai Lee

Reputation: 1312

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

Upvotes: 3

Roger
Roger

Reputation: 120

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

Upvotes: 1

Gaurav
Gaurav

Reputation: 109

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


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

Upvotes: 2

Antonino
Antonino

Reputation: 3258

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

Upvotes: 2

Related Questions