title: Proguard complains about missing classes in external JARs. How to solve this correctly?
body: <p>I am trying to obfuscate an Android 4+ app that uses Dropbox with Proguard in Eclipse. So far I have no experience with Proguard and thus I used different tutorials and answers here on SO to configure my <code>proguard-project.txt</code>:</p>
  
  <pre><code>-optimizationpasses 5
  -dontusemixedcaseclassnames
  -dontskipnonpubliclibraryclasses
  -dontpreverify
  -verbose
  -optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
  
  -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.app.backup.BackupAgentHelper
  -keep public class * extends android.preference.Preference
  -keep public class com.android.vending.licensing.ILicensingService
  </code></pre>
  
  <p>When I try to export the APK using the <code>File/Export.../Export Android Application/...</code> dialog the creation fails with an Proguard error:</p>
  
  <pre><code>[2014-08-29 09:50:30 - MyApp] Proguard returned with error code 1. See console
  [2014-08-29 09:50:30 - MyApp] Note: there were 367 duplicate class definitions.
  [2014-08-29 09:50:30 - MyApp] Warning: org.apache.commons.logging.impl.ServletContextCleaner: can't find superclass or interface javax.servlet.ServletContextListener
  [2014-08-29 09:50:30 - MyApp] Warning: org.apache.http.entity.mime.FormBodyPart: can't find superclass or interface org.apache.james.mime4j.message.BodyPart
  ...
  [2014-08-29 09:50:30 - MyApp] Warning: library class android.net.http.AndroidHttpClient extends or implements program class org.apache.http.client.HttpClient
  ...
  [2014-08-29 09:50:30 - MyApp] Warning: org.bouncycastle.x509.util.LDAPStoreHelper: can't find referenced class javax.naming.directory.DirContext
  [2014-08-29 09:50:30 - MyApp]       You should check if you need to specify additional program jars.
  [2014-08-29 09:50:30 - MyApp] Warning: there were 223 unresolved references to classes or interfaces.
  [2014-08-29 09:50:30 - MyApp]          You may need to specify additional library jars (using '-libraryjars').
  [2014-08-29 09:50:30 - MyApp] Warning: there were 1 instances of library classes depending on program classes.
  [2014-08-29 09:50:30 - MyApp]          You must avoid such dependencies, since the program classes will
  [2014-08-29 09:50:30 - MyApp]          be processed, while the library classes will remain unchanged.
  [2014-08-29 09:50:30 - MyApp] Warning: there were 13 unresolved references to program class members.
  [2014-08-29 09:50:30 - MyApp]          Your input classes appear to be inconsistent.
  [2014-08-29 09:50:30 - MyApp]          You may need to recompile them and try again.
  [2014-08-29 09:50:30 - MyApp]          Alternatively, you may have to specify the option 
  [2014-08-29 09:50:30 - MyApp]          '-dontskipnonpubliclibraryclassmembers'.
  [2014-08-29 09:50:30 - MyApp] java.io.IOException: Please correct the above warnings first.
  [2014-08-29 09:50:30 - MyApp]   at proguard.Initializer.execute(Initializer.java:321)
  [2014-08-29 09:50:30 - MyApp]   at proguard.ProGuard.initialize(ProGuard.java:211)
  [2014-08-29 09:50:30 - MyApp]   at proguard.ProGuard.execute(ProGuard.java:86)
  [2014-08-29 09:50:30 - MyApp]   at proguard.ProGuard.main(ProGuard.java:492) 
  </code></pre>
  
  <p>First Thing I tried was to add some <code>-libraryjars ...</code> commands:</p>
  
  <pre><code>-libraryjars 'F:/Path/To/Workspace/Third Party/Dropbox/dropbox-android-sdk-1.6.1/lib/bcprov-jdk16-146.jar'
  -libraryjars 'F:/Path/To/Workspace/Third Party/Dropbox/dropbox-android-sdk-1.6.1/lib/commons-logging-1.1.1.jar'
  -libraryjars 'F:/Path/To/Workspace/Third Party/Dropbox/dropbox-android-sdk-1.6.1/lib/dropbox-android-sdk-1.6.1.jar'
  -libraryjars 'F:/Path/To/Workspace/Third Party/Dropbox/dropbox-android-sdk-1.6.1/lib/httpclient-4.0.3.jar'
  -libraryjars 'F:/Path/To/Workspace/Third Party/Dropbox/dropbox-android-sdk-1.6.1/lib/httpcore-4.0.1.jar'
  -libraryjars 'F:/Path/To/Workspace/Third Party/Dropbox/dropbox-android-sdk-1.6.1/lib/httpmime-4.0.3.jar'
  -libraryjars 'F:/Path/To/Workspace/Third Party/Dropbox/dropbox-android-sdk-1.6.1/lib/json_simple-1.1.jar'
  </code></pre>
  
  <p><strong>This does not solve the problem.</strong> In fact now there are 2468 duplicate class definitions (367 before...)</p>
  
  <p>The next I tried is to ignore the warnings:</p>
  
  <pre><code>-dontwarn org.bouncycastle.** 
  -dontwarn org.apache.** 
  </code></pre>
  
  <p>This solves the problem! The creation of the APK now runs without any error. Fine... But I don't have a good feeling about this. <strong>Is ignoring warnings really the best way to solve this issue?</strong> Is this the "corrent" way of handling such issues?</p>
  
  <p>When I run the APK on my device and try to use the Dropbox functions the app crashes. But this can be solved by adding the following:</p>
  
  <pre><code>-keep class org.** { *; }
  -keep class com.dropbox.** {*;}
  </code></pre>
  
  <p>This protects the Dropbox code from being obfruscated. But again I am not sure if this is the right way to handle this.</p>
  
  <p>So far the app seems to work fine with this configuration. But is there any way I can be sure Proguard did not broke anything (beside running a complete beta-test of every app function everytime the app is created?)</p>
  
  <p>Thank your very much!</p>