Does my leak work? How to know?

I believe that I have successfully installed LeakCanary.

I added the debug, release, and test dependencies to the build.gradle file.

I added the necessary files to my application class. Imported as needed. A confirmed application class is correctly added to the manifest. Do I need to explicitly call the application class?

<application
    android:name=".MyApplication"
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"

I run my application on an emulator and see nothing else. I control the Android monitor and see no difference. How to find out if everything works? I shared my application class.

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();
}

}

+4
source share
1 answer

Do I need to explicitly specify the application class?

No.

How to find out if everything works?

- . , static.

+2

Source: https://habr.com/ru/post/1665418/


All Articles