VideoView内存泄漏?

时间:2018-09-27 07:33:23

标签: android memory-leaks android-videoview

遇到了许多人已经遇到的VideoView内存泄漏。我已经按照以下方式处理了我的代码

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_splash);

    String path = "android.resource://" + getPackageName() + File.separator + R.raw.splash_video;
    videoView.setOnCompletionListener(this);
    videoView.setOnErrorListener(this);
    videoView.setVideoURI(Uri.parse(path));
    videoView.start();
}

@Override
protected void onDestroy() {
    videoView.setOnCompletionListener(null);
    videoView.setOnErrorListener(null);
    super.onDestroy();

}

内存泄漏报告如下所示:

enter image description here

我尝试了以下链接中提供的解决方案,但没有任何效果。

https://gist.github.com/jankovd/891d96f476f7a9ce24e2

https://medium.com/@chauyan/confirmed-videoview-leak-on-android-ac502856a6cf

VideoView memory leak

任何帮助将不胜感激!

0 个答案:

没有答案