Why application is dying randomly?

前端 未结 4 687
南笙
南笙 2020-12-13 19:43

I am developing an music player app. All works fine except the app dies suddenly. Sometimes this happens when the app starts, and sometimes after running for long time. Some

4条回答
  •  甜味超标
    2020-12-13 20:09

    I found out the problem.

    I had been initializing a Visualizer class which object inside the onPrepareListener() of a media player.

    So whenever media player was calling prepare() function, the Visualizer object had been created again and again, thus it affected the memory and resulted into app die.

    Removing the Visualizer initialization code from onPrepareListener() and initializing the object only once solved the problem. Now the app no longer crashes.

提交回复
热议问题