Android 传递消息时出错:未找到ServiceIntent

Android 传递消息时出错:未找到ServiceIntent,android,service,firebase-cloud-messaging,amazon-sns,firebase-notifications,Android,Service,Firebase Cloud Messaging,Amazon Sns,Firebase Notifications,我正在尝试将AWS SNS推送服务与我的Android应用程序中的FCM集成。 当我试图通过SNS在线控制台发送推送消息时,我得到以下错误日志: E/FirebaseInstanceId: Failed to resolve target intent service, skipping classname enforcement E/PushListenerService: From: ************ /* My Sender ID*/ E/PushListenerService:

我正在尝试将AWS SNS推送服务与我的Android应用程序中的FCM集成。
当我试图通过SNS在线控制台发送推送消息时,我得到以下错误日志:

E/FirebaseInstanceId: Failed to resolve target intent service, skipping classname enforcement
E/PushListenerService: From: ************ /* My Sender ID*/
E/PushListenerService: Message: hola
E/FirebaseInstanceId: Error while delivering the message: ServiceIntent not found.
我在网上搜索了一下,发现a似乎是一个非常流行的答案,有3种服务,分别是
gcminentservice
GcmIDListenerService
RegistrationEntService
。我已经将这些类和服务添加到我的应用程序中,但我仍然没有收到来自SNS的推送通知。
我也不确定它是否适合我,因为我不仅使用FCM服务,还使用SNS服务

这些是我清单中现有的接收者和服务:

    <receiver android:name="com.google.android.gms.gcm.GcmReceiver"
        android:exported="true"
        android:permission="com.google.android.c2dm.permission.SEND" >
        <intent-filter>
            <action android:name="com.google.android.c2dm.intent.RECEIVE"/>
            <category android:name="com.intap.appme" />
        </intent-filter>
    </receiver>

    <service android:name=".PushListenerService"
        android:exported="false" >
        <intent-filter>
            <action android:name="com.google.android.c2dm.intent.RECEIVE"/>
        </intent-filter>
    </service>
build.gradle依赖项:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    wearApp project(':wear')
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:24.1.1'
    compile 'com.android.support:design:24.1.1'
    compile fileTree(dir: 'libs', include: ['activation.jar'])
    compile fileTree(dir: 'libs', include: ['additionnal.jar'])
    compile fileTree(dir: 'libs', include: ['mail.jar'])
    compile 'com.amazonaws:aws-android-sdk-core:2.2.18'
    compile 'com.amazonaws:aws-android-sdk-s3:2.2.18'
    compile 'com.amazonaws:aws-android-sdk-ddb:2.2.18'
    compile 'com.amazonaws:aws-android-sdk-ddb-mapper:2.2.18'
    compile 'com.amazonaws:aws-android-sdk-ec2:2.2.18'
    compile 'com.google.android.gms:play-services-plus:9.0.1'
    compile 'com.amazonaws:aws-android-sdk-sns:2.2.18'
    compile 'com.google.android.gms:play-services-gcm:9.0.1'
    compile 'com.android.support:multidex:1.0.1'
    apply plugin: 'com.google.gms.google-services'
}

你能帮我找出并解决它吗?

首先,你应该在依赖项块不在其中之后应用google服务插件。此外,我没有看到任何正在添加FirebaseInstanceID的依赖项,因此我不确定为什么会出现此错误。同时使用FCM和GCM也不是一个好主意,因为同一消息有多个接收者。用一个或另一个。这可能就是sns消息未被接收的原因。

'implementation'com.google.firebase:firebase messaging:17.4.0'
添加到依赖项部分的应用程序级别build.gradle文件中

dependencies {
    implementation 'com.google.firebase:firebase-core:16.0.7'
    implementation 'com.google.firebase:firebase-database:16.1.0'
    implementation'com.google.firebase:firebase-messaging:17.4.0'
}

如果您已经尝试了所有其他解决方案,但仍然出现错误,请尝试强制尝试。。。将以下代码添加到您要求提供服务或同步地图的代码中。
在Oncreate内尝试添加:

 if(ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(yourActivity.this, Manifest.permission.ACCESS_COARSE_LOCATION)!= PackageManager.PERMISSION_GRANTED) {
            ActivityCompat.requestPermissions(yourActivity.this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, LOCATION_REQUEST_CODE);

        }
        else{
            mapFragment.getMapAsync(this);
        }




and inside onConnected method try adding.

if(ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(yourActivity.this, Manifest.permission.ACCESS_COARSE_LOCATION)!= PackageManager.PERMISSION_GRANTED)
        { 
ActivityCompat.requestPermissions(youractivity.this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION},LOCATION_REQUEST_CODE );

        }

添加firebase消息依赖项对我很有用

implementation 'com.google.firebase:firebase-analytics:17.0.1'
implementation 'com.google.firebase:firebase-messaging:19.0.1'

请注意,firebase messaging对firebase analytics有依赖性

您能否将build.gradle依赖性添加到问题中?我已将build.gradle依赖性添加到问题中嘿,您是如何解决的?如果您在小米上进行测试,有时无法发送消息,请参见此答案嘿,我也面临同样的问题。我还没有将FCM集成到我的应用程序中。有什么建议吗?
implementation 'com.google.firebase:firebase-analytics:17.0.1'
implementation 'com.google.firebase:firebase-messaging:19.0.1'