我在我們的項目中使用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)
任何人都知道如何解決這個問題?
編輯。
我剛剛發現,只有private static class
的構造函數被刪除,其他類的構造函數仍然存在。
任何人都知道爲什麼?
謝謝。但是剝離的代碼在庫中,所以我不能添加'@ keep'註釋 – Kent
@Keep不只是保留方法,而是保留整個類。 –
[文檔](https://developer.android.com/reference/android/support/annotation/Keep.html)指出,'@ Keep'也適用於方法。當然,如果你從課堂上保留一種方法,它必須保持對整個班級的關注,這是顯而易見的。 –