우리 프로젝트에서 Kofax를 사용하고 있으며 많은 Reflection과 Robogiuice를 사용합니다. 우리는 Dexguard를 사용하여 코드를 난독 화합니다. 우리가 가진 문제 중 하나는 개인 생성자가 제거 된 것입니다. 이미 내 코드에이 있습니다 :프로 가드 비공개 생성자 유지
-keepclassmembers class * {
private <init>(...);
}
그러나 내 수업의 생성자 중 일부는 여전히 제거됩니다.
1) Could not find a suitable constructor in >com.kofax.mobile.sdk.capture.MainModule$ReflectionMakeSize. Classes must have >either one (and only one) constructor annotated with @Inject or a zero-argument >constructor that is not private. at >com.kofax.mobile.sdk.capture.MainModule$ReflectionMakeSize.class(Unknown >Source) at >com.kofax.mobile.sdk.capture.MainModule.configure(:145)
누구든지이 문제를 해결할 수 있습니다.
EDIT.
나는 단지 private static class
의 생성자 만 제거되었고 다른 클래스의 생성자는 여전히 삭제되었음을 알았습니다.
누구나 아는 이유는 무엇입니까? 솔루션의
감사합니다. 그러나 코드가 제거 된 것은 라이브러리 내부이므로'@ keep' 주석을 추가 할 수 없습니다. – Kent
@Keep은 메소드를 유지하는 것이 아니라 전체 클래스를 유지합니다. –
[문서] (https://developer.android.com/reference/android/support/annotation/Keep.html)에서는 메소드에도 '@ Keep'을 적용 할 수 있습니다. 물론 클래스에서 하나의 메서드를 유지하면 전체 클래스에 대한 참조를 유지해야합니다. –