I added a Maven dependency that comes with native libraries to the build.gradle of my Android project. Now I would like to exclude those jniLibs from the debug APK (but keep them in the release APK).
There seem to be two problems:
-
sourceSets seem to only add, not overwrite.
As an experiment I added a new resource folder to my project. I was able to use this folder usingandroid.sourceSets.release.res.srcDir = 'new-folder'
, but the originalres
folder was still also included.
In my own project I just moved the jniLibs to a separate folder and then only included that for release builds, but this technique doesn’t work for the dependencies. -
I have no idea how to influence the gradle file of the dependency from the gradle file of the main project.