Garbage Collection causes : MediaPlayer finalized without being released

I think this is because you create the media player within the scope of the method, therefore, when the method completes, it goes out of scope. This means there are no references, so is ok for garbage collection.

This means, it can be free’d by the GC before it has even called onCompletion, hence won’t release before cleared. Instead, you need to store a reference to the media player as a member variable in your class.

Leave a Comment