I'm currently using LeakCanary 1.6 in my app. I followed the step and add the following in my app gradle file
debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.6.1'
releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.6.1'
debugImplementation 'com.squareup.leakcanary:leakcanary-support-fragment:1.6.1'
And then in my app I have this following code
override fun 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
}
LeakCanary.install(this)
if (BuildConfig.DEBUG) {
Timber.plant(DebugTree())
}
}
However, after clean building and installing apk via "Run", it was not installed on the emulator. My emulator info is
Emulator Name : Nexus9_API_27
Emulator Version - 27.3.9-4899998
Android Version - 8.1 (Oreo) - API 27
I also tried with my physical device but it seem to be not installed in there too.
Device Name : Xiaomi A1
Android Version : 8.1.0 (July Update)
I couldn't find anything in the logcat that might be related to Logcat either.
EDIT: I found out that on 1.5.4, "Leaks" was installed on the device too, but on 1.6.1, was this feature removed? If that's the case, this issue can be closed
Hi @vincent-paing ! Just to clarify, when you say "LeakCanary is not installed", do you mean that the icon that starts the activity that displays the list of leaks is missing?
If yes: that's a slight change from before, we only enable it when we find the first leak. The idea was that until then, there's no reason to go see the list of leaks since it's empty. Maybe that was a bad assumption?
You can call LeakCanary.enableDisplayLeakActivity(context) on app startup to ensure the leakcanary icon is always showing.
Yes I meant that the icon is missing on my launcher. I was confused because it used to work back in 1.5.4. I guess we can close this issue now then
thanks ,solve my problem!
Most helpful comment
Hi @vincent-paing ! Just to clarify, when you say "LeakCanary is not installed", do you mean that the icon that starts the activity that displays the list of leaks is missing?
If yes: that's a slight change from before, we only enable it when we find the first leak. The idea was that until then, there's no reason to go see the list of leaks since it's empty. Maybe that was a bad assumption?
You can call
LeakCanary.enableDisplayLeakActivity(context)on app startup to ensure the leakcanary icon is always showing.