2016-02-24 34 views
0

我正在建立一個解析推送通知服務的應用程序。我使用的是在清單中聲明我的自定義接收器:Parse.com清除異常與ParsePushBroadcastReceiver

<receiver android:name="com.company.appname.push.PushReceiver" 
     android:exported="false" 
     > 
     <intent-filter> 
      <action android:name="com.parse.push.intent.RECEIVE" /> 
      <action android:name="com.parse.push.intent.DELETE" /> 
      <action android:name="com.parse.push.intent.OPEN" /> 
     </intent-filter> 
    </receiver> 

當我構建和測試的第一時間應用程序,它的工作原理。但是,當我做任何改變,構建應用程序並運行它(以前的版本應重新安裝),我收到此錯誤:

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.company.appname/com.company.appname.MainActivity}: java.lang.IllegalStateException: In order to use the ParsePush.subscribe or ParsePush.unsubscribe methods you must add the following to your AndroidManifest.xml: 
<receiver android:name="com.parse.ParsePushBroadcastReceiver" 
android:exported="false"> 
<intent-filter> 
    <action android:name="com.parse.push.intent.RECEIVE" /> 
    <action android:name="com.parse.push.intent.OPEN" /> 
    <action android:name="com.parse.push.intent.DELETE" /> 
</intent-filter> 
</receiver> 
    (Replace "com.parse.ParsePushBroadcastReceiver" with your own implementation if you choose to extend ParsePushBroadcastReceiver) 
    at android.app.Activityappname.performLaunchActivity(Activityappname.java:2416) 
    at android.app.Activityappname.handleLaunchActivity(Activityappname.java:2476) 
    at android.app.Activityappname.-wrap11(Activityappname.java) 
    at android.app.Activityappname$H.handleMessage(Activityappname.java:1344) 
    at android.os.Handler.dispatchMessage(Handler.java:102) 
    at android.os.Looper.loop(Looper.java:148) 
    at android.app.Activityappname.main(Activityappname.java:5417) 
    at java.lang.reflect.Method.invoke(Native Method) 
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 
    Caused by: java.lang.IllegalStateException: In order to use the ParsePush.subscribe or ParsePush.unsubscribe methods you must add the following to your AndroidManifest.xml: 
<receiver android:name="com.parse.ParsePushBroadcastReceiver" 
android:exported="false"> 
<intent-filter> 
    <action android:name="com.parse.push.intent.RECEIVE" /> 
    <action android:name="com.parse.push.intent.OPEN" /> 
    <action android:name="com.parse.push.intent.DELETE" /> 
</intent-filter> 
</receiver> 
    (Replace "com.parse.ParsePushBroadcastReceiver" with your own implementation if you choose to extend ParsePushBroadcastReceiver) 
    at com.parse.ParsePush.checkForManifestAndThrowExceptionIfNeeded(ParsePush.java:152) 
    at com.parse.ParsePush.subscribeInBackground(ParsePush.java:78) 
    at com.company.appname.api.AppnameApi.subscribeToParseChannels(AppnameApi.java:1034) 
    at com.company.appname.MainActivity.onStart(MainActivity.java:140) 
    at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1237) 
    at android.app.Activity.performStart(Activity.java:6253) 
    ... 9 more 

我需要手動卸載應用程序,並每次都安裝一個新的副本我做任何改變。

有人知道什麼是錯的嗎?謝謝。

Parse.com庫的版本是1.8.1。

+0

清單中的接收者名稱和類名顯示相同 –

+0

我使用自己的類來擴展ParsePushBroadcastReceiver。這個接收器類是明顯的。正如我所說,該應用程序正在構建並在沒有以前的版本的設備上運行。當我做出任何改變時,構建它並從Android Studio運行,我會得到這個異常。 – Daniel

回答

0

幾天後我從parse.com收到郵件說「解析將在2017年1月28日結束一年之後完全退休」,所以請檢查您是否因此發生異常,或者是否存在其他原因,因爲即使我不確定。

+0

嗨。謝謝。我知道這件事。但這不是例外。 2015年11月,當我在應用程序中進行一些更改時,我得到了此IllegalStateException異常。在這個時候它沒有被宣佈。 – Daniel