2017-06-05 72 views
0

當我在Android上使用proguard時,在處理接口後發現proguard,throws接口方法被刪除。Proguard處理接口將刪除接口方法拋出

前:

public interface Factory { 

Card create(Profile profile) throws CardException; 

} 

proguard-rules.pro:

-keep interface Factory { *; } 

後:

public interface Factory { 
Card create(Profile var1); 
} 

你可以看到,該方法的拋出被刪除。

我不知道優化,混淆器或縮小原因的原因。

+0

如果CardException是你的自定義類,所以你也必須聲明它的ProGuard。 –

+0

是的,我做過。 -keep public class * extends java.lang.Exception – Benjy

+0

看到這個https://stackoverflow.com/questions/1115515/obfuscating-method-with-throws-clause -keepattributes異常 – ChillingVan

回答

0

CardException類和 ,就把這行的基本軟件包取代com.example在proguard的文件

-keep class com.example.** { *; } 
+0

我試過了,但它沒有工作 – Benjy