Skip to content

Commit ae1c5e3

Browse files
committed
android: build.gradle - added build flavor "fail-test" to test System.loadLibrary("mpd") failure
1 parent 9eb5879 commit ae1c5e3

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

android/app/build.gradle.kts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,26 @@ android {
4444
// flavors
4545
flavorDimensions += "base"
4646
productFlavors {
47+
create("fail-test") {
48+
// To test System.loadLibrary("mpd") failure
49+
// exclude the native lib from the package
50+
packaging {
51+
jniLibs {
52+
// it appears the 'excludes' is applied to all flavors
53+
// even if it's only inside this flavor.
54+
// this filters by task name to apply the exclusion only
55+
// for this flavor name.
56+
// (clearing the 'abiFilters' will only create a universal apk
57+
// with all of the abi versions)
58+
gradle.startParameter.getTaskNames().forEach { task ->
59+
if (task.contains("fail-test", ignoreCase = true)) {
60+
println("NOTICE: excluding libmpd.so from package $task for testing")
61+
excludes += "**/libmpd.so"
62+
}
63+
}
64+
}
65+
}
66+
}
4767
create("arm64-v8a") {
4868
ndk {
4969
// ABI to include in package

0 commit comments

Comments
 (0)