Reputation: 7793
I got error in runtime:
Could not find class 'android.support.v7.widget.SearchView$5', referenced from method android.support.v7.widget.SearchView.addOnLayoutChangeListenerToDropDownAnchorSDK11
I tried to keep this class by this proguard config:
-keepattributes Exceptions,InnerClasses,Signature,Deprecated,
SourceFile,LineNumberTable,*Annotation*,EnclosingMethod
-keep class android.support.v7.widget.SearchView { public *; }
-keep class android.support.v7.widget.SearchView$* {
*;
}
-keep class android.support.v7.widget.SearchView** {
*;
}
-keep class android.support.v7.widget.SearchView$5 {
*;
}
but without luck. This is not first time proguard don't keep members by config, but this time I can't rewrite code to convert anonymous to inner class.
Upvotes: 3
Views: 2477
Reputation: 2295
This works for me (without public):
-keep class android.support.v7.widget.SearchView { *; }
Upvotes: 7
Reputation: 45678
ProGuard can't find the class android.support.v7.widget.SearchView$5 in your code or libraries. You should check that android/support/v7/widget/SearchView$5.class is present in your support jar. It seems to be present in the latest version that I have here, so maybe your copy got corrupted.
Note that adding -keep options won't help here. ProGuard checks the dependencies between classes right after having read them, before using these options.
Upvotes: 0
Reputation: 2823
Be sure you have the latest proguard version on <Android SDK>/tools/proguard
and then take a look on proguard-android.txt
. The latest proguard version provide better configurations for android.
Some definitions that might help you:
-dontoptimize
-dontpreverify
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
-keep class * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator *;
}
-keepclassmembers class **.R$* {
public static <fields>;
}
Upvotes: 0