title: Build Gradle + Proguard + APKLib
body: <p>I developed an Android Library, used by a test Application that I developed as well.</p>
  
  <p>I need to obfuscate the code of the Android Library, to be able to deliver it to some clients, without them being able to see too much of the code.
  But I need to have as a result an Android Library, with the same Structure as my Non obfuscated Library, so that I can still open it with Eclipse and use it in other applications.</p>
  
  <p>I've tried to do it with Gradle and then Proguard, but I'm having a hard time there.</p>
  
  <p>First, I used the plugin : "android-library" to build my apklib, but I can't really well understand the structure of the folders created under the build folder.</p>
  
  <p>Which folder is supposed to contain the new Android Library Project with obfuscated classes?
  Am I doin it the right way?</p>
  
  <p>Moreover I'm having a hard time, because many of the original classes don't seem to be generated and are missing once I made the build, but I can't really figure out why, what are the possibles reasons for this?</p>
  
  <p>Is it possible that it could be because of some deprecated method used, or something like that?</p>
  
  <p>My last question is about the correct way to import Library during the build, my Android Library is using some external jars to work, but if I inspect the output during the build, I can see that I seem to be losing most of the original library classes : </p>
  
  <p>16:36:33.809 [INFO] [system.out]   Original number of library classes: 5366
  16:36:33.809 [INFO] [system.out]   Final number of library classes:    615</p>
  
  <p>What could cause that?
  I know my question is pretty vague, but I've been struggling for a day with this and can't really improve my build for now.
  Any help or advice on how to properly build an Android Library with obfuscation with Gradle and Proguard would be greatly appreciated.</p>
  
  <p>Edit :</p>
  
  <p>I found some kind of related posts, but nothing is really clear about the output generated by Gradle Using Proguard. It seems that the attend output is the .aar file under the lib folder, but that's not really what I was looking for.
  So far, I kind of succeeded by using some special rules in my Proguard settings file to force some of my files to be kept with the -keep rule (but I can't really undertand why they're not kept and obfuscated if I don't put these rules). Then I used the classes.jar generated in the bundles/release folder, and moved it into a new Android Library Project libs folder, copying the resources from my original Android Library Project. Makes me an Android Library Project with obfuscated sources, but doesn't seems very clean.</p>