User doesn't logs out completely and shows previous user data on login


I am developing an android application using ROS and i encountered a strange thing as follows:
A user_1 saves or manipulates some data then logs out .After that when another user User_2 logs in with different credentials instead of seeing his own data he sees the data of the previously logged in user.And if User_2 tries to edit or manipulate this data then this updated data is not synced on the ROS.I have applied a temporary fix for this according to which i managed to restart the application on logout.Now this solves the issue now User_2 data is shown and is also updated on ROS.
This statement is executed on logout button clicked.
Please help me with this and Thanks in advance.


I had a similar issue when i had memory issues - the old users data stayed in the memory and the next user is used that.
Can you check it if that is the issue here too?


I think the issue was due to the singleton instances of dagger used in the project.I reinitialized the component and it solved the issue.