Android apk - How to exclude a .so file from a 3rd party dependency using gradle

前端 未结 1 1964
傲寒
傲寒 2021-02-01 06:56

I have an android project with several dependencies. Two of them (let\'s call them dependency A and B) have native libraries (.so files).

Dependency A has the following

相关标签:
1条回答
  • 2021-02-01 07:21

    Try a clean build, I didn't and it was still picking up the files from the previous build. I ended up deleting my app/build/ folder just to be sure.

    android { 
        packagingOptions {
            exclude 'lib/armeabi-v7a/libSomeLibYouDontWant.so'
        }
    }
    

    Worked for me on an app that was previously crashing.

    An alternative would be to use

    android{
        defaultConfig{
            ndk{
                abiFilters "armeabi", "x86"
            }
        }
    }
    

    There are some similar questions which might be helpful

    Gradle exclude arm64 libs

    How to use 32-bit native libraries on 64-bit Android device

    0 讨论(0)
提交回复
热议问题