From ae1c5e3424ece9884206acc94663e4a4b8f368ee Mon Sep 17 00:00:00 2001 From: gd <gd@iotide.com> Date: Thu, 6 Feb 2025 14:11:06 +0200 Subject: [PATCH] android: build.gradle - added build flavor "fail-test" to test System.loadLibrary("mpd") failure --- android/app/build.gradle.kts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts index 0a2618fac..bcf84c3ba 100644 --- a/android/app/build.gradle.kts +++ b/android/app/build.gradle.kts @@ -44,6 +44,26 @@ android { // flavors flavorDimensions += "base" productFlavors { + create("fail-test") { + // To test System.loadLibrary("mpd") failure + // exclude the native lib from the package + packaging { + jniLibs { + // it appears the 'excludes' is applied to all flavors + // even if it's only inside this flavor. + // this filters by task name to apply the exclusion only + // for this flavor name. + // (clearing the 'abiFilters' will only create a universal apk + // with all of the abi versions) + gradle.startParameter.getTaskNames().forEach { task -> + if (task.contains("fail-test", ignoreCase = true)) { + println("NOTICE: excluding libmpd.so from package $task for testing") + excludes += "**/libmpd.so" + } + } + } + } + } create("arm64-v8a") { ndk { // ABI to include in package