see*_*ess 9 android memory-leaks leakcanary
我相信已经成功安装了LeakCanary.
我将调试,发布和测试依赖项添加到build.gradle文件中.
我将必要的文件添加到我的Application Class中.必要时进口.确认应用程序类已正确添加到清单中.我的应用程序类是否需要显式调用?
<application
android:name=".MyApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
Run Code Online (Sandbox Code Playgroud)
我在模拟器上运行我的应用程序,看不到任何不同.我监控Android监视器并没有看到任何区别.我怎么知道它是否全部有效?我已经分享了我的Application类.
import android.app.Application;
import android.content.res.Configuration;
import com.squareup.leakcanary.LeakCanary;
public class MyApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
if (LeakCanary.isInAnalyzerProcess(this)) {
return;
}
LeakCanary.install(this);
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
}
@Override
public void onLowMemory() {
super.onLowMemory();
}
Run Code Online (Sandbox Code Playgroud)
}
| 归档时间: |
|
| 查看次数: |
2797 次 |
| 最近记录: |