4

嘗試配置推送通知時,我收到以下錯誤:無法解析意圖服務的Android

06-07 01:05:59.735 18708-18708/com.ebr.apps.ebr.development E/FirebaseInstanceId: Failed to resolve target intent service, skipping classname enforcement 
06-07 01:05:59.735 18708-18708/com.ebr.apps.ebr.development E/FirebaseInstanceId: Error while delivering the message: ServiceIntent not found. 

我有不同口味的gradle中:

我的代碼包的名字是:com.ebr。 apps.ebr 我的產品風味包:com.ebr.apps.ebr.development

我已經把谷歌,services.json在應用/ src目錄/發展

清單:

<permission 
     android:name="${applicationId}.permission.C2D_MESSAGE" 
     android:protectionLevel="signature"/> 

    <uses-permission android:name="${applicationId}.permission.C2D_MESSAGE"/> 

     <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" /> 
       <action android:name="com.google.android.c2dm.intent.REGISTRATION" /> 
       <category android:name="${applicationId}" /> 
      </intent-filter> 
     </receiver> 

     <service 
      android:name=".GCM.PushNotificationService" 
      android:exported="false"> 
      <intent-filter> 
       <action android:name="com.google.android.c2dm.intent.RECEIVE"/> 
      </intent-filter> 
     </service> 

我已經看過很多例子,但仍然得到這個錯誤。

回答

7

我找到了解決方案,問題在於Instabug GCMListener與我的GCMListener衝突。我設置了我的gcm監聽器的優先級,並開始工作。

<service 
    android:name=".GCM.PushNotificationService" 
    android:exported="false"> 
    <intent-filter android:priority="10000"> 
     <action android:name="com.google.android.c2dm.intent.RECEIVE"/> 
    </intent-filter> 
</service> 
+0

您應該將其標記爲已接受的答案。 :) –

+0

該文檔顯示「該值必須大於-1000且小於1000.」 「10000」是故意的? https://developer.android.com/reference/android/content/IntentFilter.html#SYSTEM_HIGH_PRIORITY – shkschneider

2

如果從搜索引擎過來:你可能也遇到了這個bug,這也影響了當前版本com.google.android.gms:發揮服務-GCM:9.8.0

https://github.com/firebase/quickstart-android/issues/72

這是不可能重現的錯誤,並沒有完全瞭解情況如何發生,但你可能有興趣跟隨線程。