title: Android: Configure Proguard
body: <p>I'm trying to configure proguard and have faced with some problems which are sorted by priority:</p>
  
  <ul>
  <li><p>I have received warnings of duplicates zip and cannot fix it.
  I use external libraries in "libs" directory and 2 library projects(one library project has one external lib - added to project only once) which are added to project only once. I tried to move my external jars to another directory, i.e. "lib" - just rename  due to some users have been managed to solve it so but it doesn't help me. Another way was trying to implement custom_rules to basic build.xml due to it helps some users to avoid these warning. But everything from it doesn't help me, how can I fix it? Log:</p>
  
  <pre><code>ProGuard: Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [jackson-annotations-2.1.4.jar:META-INF/MANIFEST.MF])
  ProGuard: Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [android-support-v4.jar:META-INF/MANIFEST.MF])
  ProGuard: Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [google-analytics-v2.jar:META-INF/MANIFEST.MF])
  ProGuard: Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [jackson-core-2.1.4.jar:META-INF/MANIFEST.MF])
  ProGuard: Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [httpclientandroidlib-1.1.2.jar:META-INF/MANIFEST.MF])
  ProGuard: Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [deviceprint-lib-1.0.0.jar:META-INF/MANIFEST.MF])
  </code></pre></li>
  <li><p>Last thing is some notes during  signed apk building:</p>
  
  <pre><code>ProGuard: Note: com.google.analytics.tracking.android.AdHitIdGenerator: can't find dynamically referenced class com.google.ads.AdRequest
  ProGuard: Note: the configuration refers to the unknown class 'com.google.vending.licensing.ILicensingService'
  ProGuard: Note: the configuration refers to the unknown class 'com.android.vending.licensing.ILicensingService'
  </code></pre></li>
  </ul>
  
  <p>Full proguard file:</p>
  
  <pre><code>-optimizationpasses 5
  -dontusemixedcaseclassnames
  -dontskipnonpubliclibraryclasses
  -dontpreverify
  -verbose
  
  # Otherwise return Warning: com.fasterxml.jackson.databind.ext.DOMSerializer: can't find referenced class org.w3c.dom.bootstrap.DOMImplementationRegistry
  -dontwarn com.fasterxml.jackson.databind.**
  
  -optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
  
  # Preserve all fundamental application classes.
  -keep public class * extends android.app.Activity
  -keep public class * extends android.app.Application
  -keep public class * extends android.app.Service
  -keep public class * extends android.view.View
  -keep public class * extends android.preference.Preference
  -keep public class * extends android.content.BroadcastReceiver
  -keep public class * extends android.content.ContentProvider
  
  # Preserve ActionBarSherlock and Android support libraries` classes and interfaces
  -keep class android.support.** { *; }
  -keep interface android.support.** { *; }
  -keep class com.actionbarsherlock.** { *; }
  -keep interface com.actionbarsherlock.** { *; }
  
  # Preserve all Jackson library classes
  -keep class com.fasterxml.jackson.** { *; }
  
  # Original
  -keepclasseswithmembernames class * {
      native &lt;methods&gt;;
  }
  
  -keepclasseswithmembers class * {
  public &lt;init&gt;(android.content.Context, android.util.AttributeSet);
  }
  
  -keepclasseswithmembers class * {
  public &lt;init&gt;(android.content.Context, android.util.AttributeSet, int);
  }
  
  -keep class * implements android.os.Parcelable {
  public static final android.os.Parcelable$Creator *;
  }
  
  -keepclassmembers class **.R$* {
    public static &lt;fields&gt;;
  }
  
  -keepclassmembers class * extends android.app.Activity {
  public void *(android.view.View);
  }
  
  -keepclassmembers enum * {
  public static **[] values();
  public static ** valueOf(java.lang.String);
  }
  
  #To remove debug logs:
  -assumenosideeffects class android.util.Log {
      public static *** d(...);
      public static *** v(...);
  }
  </code></pre>