I’m very new to gradle so this might not be something that can be solved here since it’s too Android specific. I hope not, though.
My overall goal is to exclude a file from my Android library’s AAR if it is a release build.
Now some background: The library I am developing needs an .so file to link against. I currently get this object by extracting it from the SQLCipher AAR (, placing it in a directory and then using
binaries.withType as described in this code about native binaries
Good news: this lets me compile! Bad news: since SQLCipher is a legitimate dependency of some of my consumers, they end up with 2 copies of the so file: one from me, and one from the SQLCipher AAR.
Now, I can use android.packagingOptions to exclude the so, which lets me build, and lets consumers consume my AAR. However, my tests can no longer run since the so has been excluded, so they don’t have access to the so.
Is there a way I can include the shared objects just for my tests? The only option I can see right now is for me to build an app that consumed my AAR and have tests in there, but that doesn’t sound right. Am I going about this the wrong way?