title: ProGuard Warning: can't write resource (Duplicate zip entry)
body: <p>First of all I know that this question already exists in stackoverflow, but I can't solve it, although I tried suggestions like not using -injar, using packagingOptions, etc</p>
  
  <p>I know the release is going to work, but I like clean builds. When I generate signed apks. After a project clean, I get those errors:</p>
  
  <pre><code>Warning:can't write resource [.readme] (Duplicate zip entry [classes.jar:.readme])
  Warning:can't write resource [META-INF/LICENSE.txt] (Duplicate zip entry [joda-time-2.8.1.jar:META-INF/LICENSE.txt])
  Warning:can't write resource [META-INF/NOTICE.txt] (Duplicate zip entry [joda-time-2.8.1.jar:META-INF/NOTICE.txt])
  </code></pre>
  
  <p>Sometimes instead of joda-time-2.8.1.jar there is commons-collections4-4.0.jar (same .readme, licence, notice) warnings.</p>
  
  <p>I tried excluding those with packagingOptions, but it doesn't work.</p>
  
  <p>Here is my module's build.gradle</p>
  
  <pre><code>apply plugin: 'com.android.application'
  
  android {
      compileSdkVersion 22
      buildToolsVersion "22.0.1"
  
      packagingOptions {
          exclude 'META-INF/LICENSE.txt'
          exclude 'META-INF/NOTICE.txt'
          exclude '.readme'
      }
  
      defaultConfig {
          applicationId 'com.example.myapp'
          minSdkVersion 15
          targetSdkVersion 22
          versionCode 1
          versionName '0.1'
      }
  
      buildTypes {
          release {
              minifyEnabled true
              proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
          }
      }
  }
  
  dependencies {
      compile fileTree(include: ['*.jar'], dir: 'libs')
      compile 'com.android.support:appcompat-v7:22.2.1'
      compile 'org.apache.commons:commons-collections4:4.0'
      compile 'org.jsoup:jsoup:1.8.2'
      compile 'com.android.support:recyclerview-v7:22.2.0'
      compile 'com.android.support:cardview-v7:22.2.0'
      compile 'com.android.support:design:22.2.0'
      compile 'com.google.android.gms:play-services-gcm:7.5.0'
      compile 'joda-time:joda-time:2.8.1'
  }
  </code></pre>
  
  <p>And my proguard-rules.pro file</p>
  
  <pre><code># Defaults
  -dontpreverify
  -repackageclasses ''
  -allowaccessmodification
  -optimizations !code/simplification/arithmetic
  -keepattributes *Annotation*
  
  -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.content.BroadcastReceiver
  -keep public class * extends android.content.ContentProvider
  
  -keep public class * extends android.view.View {
      public &lt;init&gt;(android.content.Context);
      public &lt;init&gt;(android.content.Context, android.util.AttributeSet);
      public &lt;init&gt;(android.content.Context, android.util.AttributeSet, int);
      public void set*(...);
  }
  
  -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);
  }
  
  -keepclassmembers class * implements android.os.Parcelable {
      static android.os.Parcelable$Creator CREATOR;
  }
  
  -keepclassmembers class **.R$* {
      public static &lt;fields&gt;;
  }
  
  -keep public class * extends android.support.v4.app.Fragment
  -keep public class * extends android.app.Fragment
  
  -keepnames class * implements java.io.Serializable
  
  -keepclassmembers class * implements java.io.Serializable {
      static final long serialVersionUID;
      private static final java.io.ObjectStreamField[] serialPersistentFields;
      !static !transient &lt;fields&gt;;
      !private &lt;fields&gt;;
      !private &lt;methods&gt;;
      private void writeObject(java.io.ObjectOutputStream);
      private void readObject(java.io.ObjectInputStream);
      java.lang.Object writeReplace();
      java.lang.Object readResolve();
  }
  
  -keepclasseswithmembernames class * {
      native &lt;methods&gt;;
  }
  -keepclassmembers class * {
      public void *ButtonClicked(android.view.View);
  }
  
  # Use this to prevent errors in builds.
  # usage of org.joda.time in this app does not need org.joda.convert
  -dontwarn org.joda.convert.**
  
  
  # Remove logs. Only when using 'proguard-android-optimize.txt'
  -assumenosideeffects class android.util.Log {
      public static boolean isLoggable(java.lang.String, int);
      public static int v(...);
      public static int i(...);
      public static int w(...);
      public static int d(...);
      public static int e(...);
  }
  </code></pre>
  
  <p>Thanks in advance.</p>
  
  <p>EDIT: As requested from a possible duplicate warning (<a href="https://stackoverflow.com/questions/16357959/proguard-fails-with-cant-write-resource-meta-inf-manifest-mf-duplicate-zip">Proguard warnings &quot;can&#39;t write resource [META-INF/MANIFEST.MF] (Duplicate zip entry)&quot;</a>). User that asked the question, said he is using multiple modules (instead of one) and did not post any files (due to sensitive data), so I don't know if its the same case. Also tried all possible options from the first answer and none of them worked. Other answers didn't work either (except the -dontwarn option which I am not going to use for obvious reasons).</p>