I am getting the following error in my Android
application using Parse
:
You must register this ParseObject subclass before instantiating it.
In my Application
object, I am doing the following inside onCreate
:
Parse.enableLocalDatastore(this);
Parse.initialize(this, "code", "code");
So why am I still getting this error? It was working fine yesterday but it's all of a sudden stopped working.
This is my Manifest file:
<application
android:name=".MyApplication"
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
....
LogCat:
java.lang.IllegalArgumentException: You must register this ParseObject subclass before instantiating it.
at com.parse.ParseObject.<init>(ParseObject.java:157)
at com.parse.ParseObject.<init>(ParseObject.java:119)
at usmaan.app.models.Game.<init>(Game.java:25)
at usmaan.app.models.Game.to(Game.java:86)
at usmaan.app.adapters.GamesAdapter.getView(GamesAdapter.java:47)
at android.widget.AbsListView.obtainView(AbsListView.java:2344)
at android.widget.ListView.makeAndAddView(ListView.java:1864)
You must call
ParseObject.registerSubclass(YourClassName.class);
before calling
Parse.initialize()
.
In addition, you need to annotate your custom class like this:
@ParseClassName("YourClassName")
public class YourClassName extends ParseObject
{
}
Finally, your custom class needs a default no-args constructor in order to be registered by ParseObject
.
Reference: Subclassing Parse Object
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With