Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exclude native library in Gradle Android build

Contrary to many other posts on this topic, I want to exclude a native library from an Android build with Gradle.

libfoo.so resides in a library project in the default directory thelib/src/main/jniLibs. In my main project's build.gradle I try to exlude the file as follows:

sourceSets {
    all{
        jniLibs {
            exclude '**/libfoo.so'
        }
    }
}

This does not work though, the file is still in the final APK. I tried different path specifications already, but none of them work.

Is this even possible, or is there a workaround?

like image 909
langerhans Avatar asked Apr 22 '15 09:04

langerhans


1 Answers

I know this is an old question, i solved my problem with the following

packagingOptions {
 exclude 'lib/arm64-v8a/libfoo.so'
}

Hope it helps someones...

Note: On further searching someone had already solved a similar issue; Gradle exclude arm64 libs

like image 91
user3689913 Avatar answered Nov 01 '22 23:11

user3689913