{"id":3014,"date":"2014-03-13T12:11:22","date_gmt":"2014-03-13T12:11:22","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/13\/noclassdeffounderror-when-using-proguard-collection-of-common-programming-errors-2\/"},"modified":"2014-03-13T12:11:22","modified_gmt":"2014-03-13T12:11:22","slug":"noclassdeffounderror-when-using-proguard-collection-of-common-programming-errors-2","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/13\/noclassdeffounderror-when-using-proguard-collection-of-common-programming-errors-2\/","title":{"rendered":"NoClassDefFoundError when using proguard-Collection of common programming errors"},"content":{"rendered":"<p>Rather than being as specific with the package names<\/p>\n<pre><code>-keep public class * extends android.support.v4.app.FragmentActivity\n-keep public class * extends android.support.v4.app.Fragment\n<\/code><\/pre>\n<p>Change it to this:<\/p>\n<pre><code>-keep class android.support.v4.app.** { *; }\n-keep interface android.support.v4.app.** { *; }\n<\/code><\/pre>\n<p>In the error it is looking for (note the extra <strong>p<\/strong>):<\/p>\n<pre><code>android.support.v4.appp.FragmentActivity$2 \n<\/code><\/pre>\n<p>rather than just<\/p>\n<pre><code>android.support.v4.app.FragmentActivity.\n<\/code><\/pre>\n<p>Edit, not sure what it could be, here&#8217;s a full proguard for one of my apps that uses the support library and ActionBarSherlock.<\/p>\n<pre><code>##---------------Begin: proguard configuration common for all Android apps ----------\n-optimizationpasses 5\n-dontusemixedcaseclassnames\n-dontskipnonpubliclibraryclasses\n-dontskipnonpubliclibraryclassmembers\n-dontpreverify\n-verbose\n-dump class_files.txt \n-printseeds seeds.txt \n-printusage unused.txt \n-printmapping mapping.txt \n-optimizations !code\/simplification\/arithmetic,!field\/*,!class\/merging\/*\n\n-allowaccessmodification\n-keepattributes *Annotation*\n-renamesourcefileattribute SourceFile\n-keepattributes SourceFile,LineNumberTable\n-repackageclasses ''\n\n-keep public class * extends android.app.Activity\n-keep public class * extends android.app.Application\n-keep public class * extends android.app.Service\n-keep public class * extends android.content.BroadcastReceiver\n-keep public class * extends android.content.ContentProvider\n-keep public class * extends android.app.backup.BackupAgentHelper\n-keep public class * extends android.preference.Preference\n-keep public class com.android.vending.licensing.ILicensingService\n-dontnote com.android.vending.licensing.ILicensingService\n\n# Explicitly preserve all serialization members. The Serializable interface\n# is only a marker interface, so it wouldn't save them.\n-keepclassmembers class * implements java.io.Serializable {\n    static final long serialVersionUID;\n    private static final java.io.ObjectStreamField[] serialPersistentFields;\n    private void writeObject(java.io.ObjectOutputStream);\n    private void readObject(java.io.ObjectInputStream);\n    java.lang.Object writeReplace();\n    java.lang.Object readResolve();\n}\n\n# Preserve all native method names and the names of their classes.\n-keepclasseswithmembernames class * {\n    native ;\n}\n\n-keepclasseswithmembernames class * {\n    public (android.content.Context, android.util.AttributeSet);\n}\n\n-keepclasseswithmembernames class * {\n    public (android.content.Context, android.util.AttributeSet, int);\n}\n\n# Preserve static fields of inner classes of R classes that might be accessed\n# through introspection.\n-keepclassmembers class **.R$* {\n  public static ;\n}\n\n# Preserve the special static methods that are required in all enumeration classes.\n-keepclassmembers enum * {\n    public static **[] values();\n    public static ** valueOf(java.lang.String);\n}\n\n-keep public class * {\n    public protected *;\n}\n\n-keep class * implements android.os.Parcelable {\n  public static final android.os.Parcelable$Creator *;\n}\n##---------------End: proguard configuration common for all Android apps ----------\n\n# Remove Logging statements\n-assumenosideeffects class android.util.Log {\n    public static *** d(...);\n    public static *** v(...);\n    public static *** e(...);\n    public static *** i(...);\n}\n\n##---------------Begin: proguard configuration for Gson  ----------\n# Gson uses generic type information stored in a class file when working with fields. Proguard\n# removes such information by default, so configure it to keep all of it.\n-keepattributes Signature\n\n# Gson specific classes\n-keep class sun.misc.Unsafe { *; }\n#-keep class com.google.gson.stream.** { *; }\n\n# Application classes that will be serialized\/deserialized over Gson\n-keep class com.antew.redditinpictures.library.imgur.** { *; }\n-keep class com.antew.redditinpictures.library.reddit.** { *; }\n\n##---------------End: proguard configuration for Gson  ----------\n\n\n\n##---------------Begin: proguard configuration for ActionBarSherlock  ----------\n-keep class android.support.v4.app.** { *; }\n-keep interface android.support.v4.app.** { *; }\n-keep class com.actionbarsherlock.** { *; }\n-keep interface com.actionbarsherlock.** { *; }\n\n##---------------End:   proguard configuration for ActionBarSherlock  ----------\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Rather than being as specific with the package names -keep public class * extends android.support.v4.app.FragmentActivity -keep public class * extends android.support.v4.app.Fragment Change it to this: -keep class android.support.v4.app.** { *; } -keep interface android.support.v4.app.** { *; } In the error it is looking for (note the extra p): android.support.v4.appp.FragmentActivity$2 rather than just android.support.v4.app.FragmentActivity. Edit, not [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3014","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3014","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=3014"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3014\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=3014"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=3014"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=3014"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}