Non-deprecated PackagingOptions?

1.3k views Asked by At

According to the current documentation, it seems to me that all packaging options are deprecated? So, what shall be used?

E.g. currently I use

packagingOptions {
    merge 'META-INF/NOTICE.md'
    merge 'META-INF/LICENSE.md'
}

but merge is described as deprecated: enter image description here

1

There are 1 answers

0
2BAB On BEST ANSWER

According to source code comments:

@Deprecated(
    "This property is deprecated. Use resources.merges instead.",
    replaceWith = ReplaceWith("resources.merges")
)
val merges: MutableSet<String>

@Deprecated(
    "This method is deprecated. Use resources.merges.add() instead.",
    replaceWith = ReplaceWith("resources.merges.add(pattern)")
)
fun merge(pattern: String)

Thus, it becomes:

// In build.gradle.kts
android {
    packagingOptions {
        resources {
            merges.add("META-INF/NOTICE.md")
        }
    }
}