Sahil Dave
Sahil Dave

Reputation: 433

App crashes with Runtime exception when reopening within 15-20 seconds

I enabled Local Datastore for my application. Everything is working fine, pinning and unpinning. But whenever I reopen the app (without reinstalling) within ~20 secs I get ANR with the stacktrace here.

The runtime exception says enableOfflineStore() called multiple times. but I couldnt find any disableOfflineStore or disableLocalDataStore option.

The command at line com.example.try_masterdetail.WebsiteListActivity.onCreate(WebsiteListActivity.java:60) is Parse.enableLocalDatastore(getApplicationContext()); After clicking OK on ANR dialog box and opening again the app works again.

I dont know if it is a bug or I should call something in onStop or somewhere in my Activity's lifecycle. I tried to search but couldnt find anything. Please help.

Upvotes: 1

Views: 705

Answers (2)

Sahil Dave
Sahil Dave

Reputation: 433

The problem with this is that the Parse.initialize and Parse.enableLocalDatastore should be called in class extending Application and not Activity.

Upvotes: 5

Alécio Carvalho
Alécio Carvalho

Reputation: 13647

Does it make it clear for you?

Caused by: java.lang.RuntimeException: enableOfflineStore() called multiple times. 05-09 19:06:30.928: E/AndroidRuntime(2806): at com.parse.OfflineStore.enableOfflineStore(OfflineStore.java:40) 05-09 19:06:30.928: E/AndroidRuntime(2806): at com.parse.Parse.enableLocalDatastore(Parse.java:161) 05-09 19:06:30.928: E/AndroidRuntime(2806): at

Upvotes: 0

Related Questions