Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App crashes with ClassCastException when trying to load ParseInstallation #374

Closed
shaacker opened this issue Jan 27, 2016 · 2 comments
Closed

Comments

@shaacker
Copy link

We are using Parse for all our Push Notification needs. In our latest release we updated the Parse SDK to 1.12.0 and we turned off the local datastore, as we were not using it and it somehow caused our Installations not to be saved on Parse properly (saveEventually would never finish).
Since that time, some of our users have been experiencing the following crash, some of them multiple times:

Fatal Exception: java.lang.RuntimeException: Unable to start receiver com.parse.ParseBroadcastReceiver: java.lang.ClassCastException: com.parse.ParseObject cannot be cast to com.parse.ParseInstallation
       at android.app.ActivityThread.handleReceiver(ActivityThread.java:2551)
       at android.app.ActivityThread.access$1600(ActivityThread.java:165)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1402)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loop(Looper.java:137)
       at android.app.ActivityThread.main(ActivityThread.java:5455)
       at java.lang.reflect.Method.invokeNative(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:525)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1187)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
       at dalvik.system.NativeStart.main(NativeStart.java)
Caused by java.lang.ClassCastException: com.parse.ParseObject cannot be cast to com.parse.ParseInstallation
       at com.parse.CachedCurrentInstallationController$2$1$1.then(CachedCurrentInstallationController.java:94)
       at com.parse.CachedCurrentInstallationController$2$1$1.then(CachedCurrentInstallationController.java:91)
       at bolts.Task$14.run(Task.java:798)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
       at java.lang.Thread.run(Thread.java:841)

Unfortunately, this doesn't happen on any of our devices we have in the office, so I can't get the file in question from the device. This ties into #371. Being able to upload the file in question for debugging would definitely be helpful.

@grantland
Copy link
Contributor

  • Parse-SDK-Android: 1.12.0
  • Local Datastore enabled: false
  • Push: PPNS
  • The crash is coming from ParseBroadcastReceiver, most likely from ParseInstallation.getCurrentInstallation()

Where is your Parse.initialize(...) code? This code registers ParseInstallation as a ParseObject subclass and without it will initialize them incorrectly as ParseObjects. If it's not in your Application#onCreate(), you'll get this error whenever ParseBroadcastReceiver is launched, such as android.intent.action.BOOT_COMPLETED, android.intent.action.USER_PRESENT, or any other intent-filters you have on this receiver.

@shaacker
Copy link
Author

Thanks for the super fast response and pointing that out @grantland. It makes sense and is probably the reason why this is happening. We recently put the call to Parse.initialize(...) and a call to ParseConfig.getCurrentConfig() into a background operation because we noticed ParseConfig.getCurrentConfig() was slowing down the start time of our app.

I moved the Parse.initialize(...) outside of that background operation now and will monitor the issue going forward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants