title: How to stop ProGuard from stripping the Serializable interface from a class
body: <p>Is there an explicit way to stop ProGuard from changing a class from implementing an interface?</p>
  
  <p>I have a class that implements <code>java.io.Serializable</code>, let's call it <code>com.my.package.name.Foo</code>. I've found that after running through ProGuard, it no longer implements <code>Serializable</code>. I get <code>null</code> after I cast from <code>Serializable</code> to <code>Foo</code> and <code>false</code> if I check an instance with <code>instanceof Serializable</code>. I've made sure to set ProGuard to ignore this class:</p>
  
  <pre><code>-keep class com.my.package.name.Foo
  </code></pre>
  
  <p>I've also tried:</p>
  
  <pre><code>-keep class com.my.package.name.Foo { *; }
  </code></pre>
  
  <p>and I've also tried the whole package by doing this:</p>
  
  <pre><code>-keep class com.my.package.name.** { *; }
  </code></pre>
  
  <p>or:</p>
  
  <pre><code>-keep class com.my.package.** { *; }
  </code></pre>
  
  <p>and also just to keep all <code>Serializable</code> classes:</p>
  
  <pre><code>-keep class * implements java.io.Serializable { *; }
  </code></pre>
  
  <p>but to no avail. I have another class in a sibling package (roughly: <code>com.my.package.name2.Bar</code>) that also implements <code>Serializable</code> and is used similarly but has no issues.</p>
  
  <p>I'm not sure it's relevant, but I'm packing this in a jar for use with Android. The code that uses these classes include putting them in <code>Bundle</code>s which is why I need <code>Serializable</code>. I considered that perhaps somehow ProGuard thinks that <code>Foo</code> is never used as a <code>Serializable</code> but that seems unlikely given that I pass it as a parameter to <code>Bundle.putSerializable(String, Serializable)</code> and also I do an implicit cast: <code>Serializable serializable = foo;</code>. In fact, when I debug, I can see the <code>Foo</code> get put into the <code>Bundle</code> and I can examine the <code>Bundle</code> and see the instance of <code>Foo</code> there, but when retrieving it the cast fails. </p>