gpt4 book ai didi

android - 我的应用程序在使用泄漏金丝雀时卡住 - 为什么?

转载 作者:行者123 更新时间:2023-11-29 18:36:44 26 4
gpt4 key购买 nike

我正在开发一个 Android TV 应用程序,我在其中使用了 Leak Canary Library,但问题是当我在一段时间后使用我的应用程序时,它会显示错误“Dumping Memory.App Freezes.Brrrr”。我在 Google 上搜索了建议的内容,但仍然收到错误。

在 list 中,我提供了写入和读取存储的权限。

应用类代码:

     public class App extends Application {

private RefWatcher refWatcher;

public static RefWatcher getRefWatcher(Context context) {
App application = (App) context.getApplicationContext();
return application.refWatcher;
}

@Override
public void onCreate() {
super.onCreate();
refWatcher = LeakCanary.install(this);

}

在我的 Activity 和 Fragments 中,我在 OnDestroy() 中使用了 RefWatcher。方法。

        @Override
protected void onDestroy() {

if (timer != null) {
timer.cancel();
timer = null;
}
if (handler != null)
handler.removeCallbacks(Update);
super.onDestroy();


RefWatcher refWatcher = App.getRefWatcher(this);
refWatcher.watch(this);
}

但我仍然遇到 Dumping Memory 错误。请帮忙。

最佳答案

如消息所示,LeakCanary 卡住应用程序以转储其当前内存以供分析。这是正常行为并且是有意的。您应该会收到有关潜在检测到的泄漏的更多详细信息的通知。您还可以查看“Leaks”-App 或您的应用程序的 logcat 输出以了解详细信息。

关于android - 我的应用程序在使用泄漏金丝雀时卡住 - 为什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54039386/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com