我的应用类代码:
import android.app.Application;
import android.os.Process;
import com.squareup.leakcanary.LeakCanary;
public class SampleApplication extends Application {
public SampleApplication() {
super();
}
@Override
public void onCreate() {
super.onCreate();
//noinspection ConstantConditions
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);
// Normal app init code...
}
@Override
public void onTerminate() {
System.exit(0);
Process.killProcess(Process.myPid());
super.onTerminate();
}
}
Android Studio 3.1 Canary 7 - >分析 - >检查代码 - > OK:
声明访问可以进行较弱的检查
1警告:SampleApplication可以是包私有
Application类可以是包私有还是lint错误?