I am currently using objectbox via koin dependency injection within my android app. It works fine however i need to re-initialise my DI and so i need to destroy the boxStore before. This is because i initialise the box via DI and if i do not destroy the current BoxStore I cannot create a new one.
I've found a similar post How to close Objectbox Store and delete data files however it hasn't solved my issue.
I have tried calling deleteAllFiles however i am getting an error.
BoxStore.deleteAllFiles(context, (BoxStoreBuilder.DEFAULT_NAME))
BoxStore.deleteAllFiles(context, null)
I am getting the error message:
java.lang.IllegalStateException: Cannot delete files: store is still open
this is on the line of code mentioned above. Any suggestions would be very helpful