Android: When do classes get unloaded by the system?

前端 未结 2 410
小蘑菇
小蘑菇 2020-12-11 17:18

This is a very weird problem. My app that runs just fine but somehow if I leave my phone for an hour or two while my app is running, I get the following error when I come ba

2条回答
  •  轮回少年
    2020-12-11 18:01

    Are you playing games with custom classloaders?

    I ask, because if yoga.YogaActivity and yoga.database.Manager are standard Java classes in the same Android APK file, you should not have one in memory and the other not. I have never seen Android unload classes on a one-off basis -- leastways, I have never run into this particular problem before.

    Also:

    I leave my phone for an hour or two while my app is running

    You might want to clarify what you mean by this. Do you mean that you leave your activity in the foreground? Do you mean that you press HOME and then come back to it hours later? Do you mean something else?

提交回复
热议问题