Search code examples
androidparse-platformbroadcastreceiver

Unable to start receiver com.parse.ParseBroadcastReceiver: java.lang.IllegalArgumentException: Operation is invalid after previous operation


I have Parse integrated in my app for push notifications. I am getting a lot of crashes on many devices related to parse. I haven't even sent any push notifications yet. and i am using parse sdk 1.8.1. Here is the stack trace -

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

I am initialising Parse in the Application subclass. and i have registered it in the manifest class correctly.

<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>

Solution

  • I fixed my problem by disabling local data storage. I had this method call before initialising parse -

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

    I just had to remove the enableDataStore() method call. Not sure why was it causing this issue.