2017-12-30 52 views
0

내 proguard 규칙에 다음 코드를 사용하여 log.d를 제거합니다. 출시 apk를 컴파일하기 전에 남겨 뒀을 수도 있습니다.내 apk에서 목재 로그를 벗겨 내기

> -assumenosideeffects class android.util.Log { 
>  public static *** d(...); 
>  public static *** v(...); } 

모든 목재 로그에 적용 할 수있는 방법이 있습니까?

Timber.w("This shouldn't show in release apk when decompiled"); 

답변

0

같은 접근 방식은겠습니까 -하지만 Timber 클래스 대신 Log를 사용하여 - 작동하지? 예컨대 : 또는

-assumenosideeffects class timber.log.Timber* { 
    public static *** v(...); 
    public static *** d(...); 
    public static *** i(...); 
} 

, 당신은 sample project을 따라 같은 것을 할 수있는 다음 난독 화 코드가 작동

public class App extends Application { 
    @Override 
    public void onCreate() { 
    super.onCreate(); 

    if (BuildConfig.DEBUG) { 
     Timber.plant(new DebugTree()); 
    } else { 
     Timber.plant(new ProductionTree()); 
    } 
    } 

    private static class ProductionTree extends Timber.Tree { 
    @Override 
    protected void log(int priority, String tag, String message, Throwable t) { 
     // Do whatever (or nothing) here. 
    } 
    } 
} 
+0

합니다. 권장 된 두 번째 접근 방식은 실제로 코드를 제거하지 않고 구현을 변경하기 때문에 내가 가지 않았기 때문입니다. – RJFares