无法启动接收器com.parse.ParseBroadcastReceiver:java.lang.IllegalArgumentException:上一次操作后操作无效

时间:2015-05-12 07:00:29

标签: android parse-platform broadcastreceiver

我在我的应用中集成了Parse用于推送通知。我在许多与解析相关的设备上遇到了很多崩溃。我还没发送任何推送通知。我正在使用解析sdk 1.8.1。这是堆栈跟踪 -

android.app.ActivityThread.handleReceiver   ActivityThread.java, line 2554
2   android.app.ActivityThread.access$1700  ActivityThread.java, line 163
3   android.app.ActivityThread$H.handleMessage  ActivityThread.java, line 1333
4   android.os.Handler.dispatchMessage  Handler.java, line 102
5   android.os.Looper.loop  Looper.java, line 157
6   android.app.ActivityThread.main ActivityThread.java, line 5335
7   java.lang.reflect.Method.invokeNative   
8   java.lang.reflect.Method.invoke Method.java, line 515
9   com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run  ZygoteInit.java, line 1265
10  com.android.internal.os.ZygoteInit.main ZygoteInit.java, line 1081
11  dalvik.system.NativeStart.main  
Caused by: java.lang.IllegalArgumentException: Operation is invalid after previous operation.
1   com.parse.ParseRemoveOperation.mergeWithPrevious    SourceFile, line 53
2   com.parse.ParseOperationSet.mergeFrom   SourceFile, line 62
3   com.parse.ParseObject.mergeREST SourceFile, line 889
4   com.parse.OfflineStore$13$2.then    SourceFile, line 798
5   com.parse.OfflineStore$13$2.then
6   a.h$5.run   SourceFile, line 755
7   a.d$a.execute   SourceFile, line 105
8   a.h.c   SourceFile, line 746
9   a.h.a   SourceFile, line 545
10  a.h.a   SourceFile, line 556
11  a.h$3.a SourceFile, line 650
12  a.h$3.then  SourceFile, line 638
13  a.h$6.run   SourceFile, line 796
14  a.d$a.execute   SourceFile, line 105
15  a.h.d   SourceFile, line 787
16  a.h.b   SourceFile, line 599
17  a.h.b   SourceFile, line 574
18  a.h.c   SourceFile, line 638
19  a.h.c   SourceFile, line 662
20  com.parse.OfflineStore$13.then  SourceFile, line 795
21  com.parse.OfflineStore$13.then  SourceFile, line 754
22  a.h$6.run   SourceFile, line 796
23  a.d$a.execute   SourceFile, line 105
24  a.h.d   SourceFile, line 787
25  a.h.b   SourceFile, line 599
26  a.h.b   SourceFile, line 610
27  a.h$4.a SourceFile, line 702
28  a.h$4.then  SourceFile, line 690
29  a.h$6.run   SourceFile, line 796
30  a.d$a.execute

我正在Application子类中初始化Parse。我已经在清单类中正确注册了它。

<service android:name="com.parse.PushService" />

        <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.DELETE" />
                <action android:name="com.parse.push.intent.OPEN" />
            </intent-filter>
        </receiver>

        <receiver android:name="com.parse.ParseBroadcastReceiver">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED" />
                <action android:name="android.intent.action.USER_PRESENT" />
            </intent-filter>
        </receiver>

        <receiver android:name="com.parse.GcmBroadcastReceiver"
            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="my_app_package" />
            </intent-filter>
        </receiver>

1 个答案:

答案 0 :(得分:1)

我通过禁用本地数据存储来解决我的问题。在初始化解析之前我有这个方法调用 -

            Parse.enableLocalDatastore(this);
            Parse.initialize(this, "key", "key");
            ParseInstallation.getCurrentInstallation().saveInBackground();

我只需要删除enableDataStore()方法调用。不知道为什么会导致这个问题。