I'm working on an app that uses a third party SDK that is closed source. This SDK includes some native libraries for features that aren't used by the app, and these features can be disabled in code. However, the native libraries are still included in the APK/bundle which results in a larger install and download size. To exclude these libraries from the packaged APK/bundle you can do the following in your build.gradle.kts
file.
// Excludes all ABIs
android {
// ...
packaging {
jniLibs {
exclude("lib/*/libtoexclude.so")
}
}
}
// Specify which ABI to exclude
android {
// ...
packaging {
jniLibs {
exclude("lib/armeabi-v7a/libtoexclude.so")
}
}
}