How To Exclude Specific Resources from an AAR Depedency?

前端 未结 4 1387
清歌不尽
清歌不尽 2020-12-03 01:04

Is there a reasonably simple way for a module\'s build.gradle file to indicate that certain files from a dependency should be excluded? I am specifically intere

4条回答
  •  无人及你
    2020-12-03 01:32

    I believe you can solve this problem more elegantly using the PackagingOptions facility of the Android Gradle Plugin DSL.

    I was able to use this myself to exclude some native libraries I didn't need introduced by an AAR in my project.

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

    For the case outlined in the question, I believe this would work:

    android {
        ...
        packagingOptions {
            exclude '/res/values-v21/'
        }
    }
    

提交回复
热议问题