leakcanary: Could not dump heap, previous analysis still is in progress.
More than ten minutes. Android Studio 3.0.1, Android 5.1.1 or 7.1.1 .
public class MyApplication extends Application {
private RefWatcher refWatcher;
@Override
public void onCreate() {
super.onCreate();
if (LeakCanary.isInAnalyzerProcess(this)) {
// This process is dedicated to LeakCanary for heap analysis.
// You should not init your app in this process.
return;
}
refWatcher=LeakCanary.install(this);
}
public static RefWatcher getRefWatcher(Context context){
MyApplication myApplication= (MyApplication) context.getApplicationContext();
return myApplication.refWatcher;
}
}
in Activity class
@Override
protected void onDestroy() {
super.onDestroy();
MyApplication.getRefWatcher(getApplicationContext()).watch(Main2Activity.this);
}
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 13
- Comments: 29 (4 by maintainers)
In demo, if I use
debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.5.4'
releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.4'
It will prompt “Could not dump heap, previous analysis still is in progress.” if I import moduledebugImplementation project(':leakcanary-android')
releaseImplementation project(':leakcanary-android-no-op')
It will be ok. That can reproduce this issue.