개발/안드로이드
[안드로이드 / android] 디버깅 도구 정리
맨날치킨
2018. 7. 5. 20:58
반응형
LeakCanary
Leak Canary 경우 메모리 누수를 감지해주는 디버깅 툴이다. 액티비티에서 메모리 누수가 발견될경우 사용자에게 알람을 띄워주며, 별도의 프래그먼트에서 누수를 감지하고싶으면 refWatcher로 집어넣어준다음에 onDestory 가 호출될때 refWatcher도 별도로 호출해야한다.
사용법
dependencies {
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5'
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
}
@Override // BaseApplication.java
public void onCreate() {
if (LeakCanary.isInAnalyzerProcess(this)) return;
refWatcher = LeakCanary.install(this);
}
public static RefWatcher getRefWatcher(Context context) { // Fragment Leak 감지하려면, Fragment 에서 refWatcher 을 이용해서 watch 를 시켜야한다
DebugApplication application = (DebugApplication) context.getApplicationContext();
return application.refWatcher;
}
Hugo
Hugo 는 annotation-based 로깅 툴이다. 사용하기도 매우 간편하다. Log.d(TAG, message) 를 호출하기보다, @DebugLog annotation 하나만 추가하면, 메소드가 실행되는데 걸린 시간부터 파레메터로 받은 변수들 까지 다 손쉽게 볼 수 있는 것이다.
사용법
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.jakewharton.hugo:hugo-plugin:1.2.1'
}
}
apply plugin: 'com.android.application'
apply plugin: 'com.jakewharton.hugo'
@DebugLog
public String getName(String first, String last) {
return first + " " + last;
}
출력 화면
V/Example: ? getName(first="Jake", last="Wharton")
V/Example: ? getName [16ms] = "Jake Wharton"
Leak Canary 경우 메모리 누수를 감지해주는 디버깅 툴이다. 액티비티에서 메모리 누수가 발견될경우 사용자에게 알람을 띄워주며, 별도의 프래그먼트에서 누수를 감지하고싶으면 refWatcher로 집어넣어준다음에 onDestory 가 호출될때 refWatcher도 별도로 호출해야한다.
사용법
dependencies {
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5'
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
}
@Override // BaseApplication.java
public void onCreate() {
if (LeakCanary.isInAnalyzerProcess(this)) return;
refWatcher = LeakCanary.install(this);
}
public static RefWatcher getRefWatcher(Context context) { // Fragment Leak 감지하려면, Fragment 에서 refWatcher 을 이용해서 watch 를 시켜야한다
DebugApplication application = (DebugApplication) context.getApplicationContext();
return application.refWatcher;
}
Hugo
Hugo 는 annotation-based 로깅 툴이다. 사용하기도 매우 간편하다. Log.d(TAG, message) 를 호출하기보다, @DebugLog annotation 하나만 추가하면, 메소드가 실행되는데 걸린 시간부터 파레메터로 받은 변수들 까지 다 손쉽게 볼 수 있는 것이다.
사용법
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.jakewharton.hugo:hugo-plugin:1.2.1'
}
}
apply plugin: 'com.android.application'
apply plugin: 'com.jakewharton.hugo'
@DebugLog
public String getName(String first, String last) {
return first + " " + last;
}
출력 화면
V/Example: ? getName(first="Jake", last="Wharton")
V/Example: ? getName [16ms] = "Jake Wharton"
반응형