From f78b62751d8c0d183478d73facb06392940daee7 Mon Sep 17 00:00:00 2001 From: Grisha Kruglov Date: Tue, 29 Jan 2019 16:26:03 -0800 Subject: [PATCH] Use abiFilter in product flavour definitions to filter for the supported architectures This fixes a regression from https://github.com/mozilla-mobile/fenix/pull/294 That patch adds a dependency which loads some native libraries. Those native libs are shipped for a variety of architectures. Specifically, there are versions of aarch64 and armv7. What seems to happen is that since those libraries are loaded first (GV is lazily initialized after history stuff), and since aarch64 versions of these libs is chosen by the native loader, consequent native loads select for the same abi type. aarch64 version of libmozglue isn't there, loader fails to find it and we crash. Being explicit with the abiFilter in the product flavour definitions strips out aarch64 app-services libs from the apk. When they're loaded first, armv7 versions are picked (since we don't have any other ones), and everything works correctly afterwards. Another way to achieve the same result would be to exclude arm64 libs via packagignOptions directive: packagingOptions { exclude "lib/arm64-v8a/**" } ... but that's a less flexible approach in the longer term. --- app/build.gradle | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 55995c585..b4591a0b3 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -26,8 +26,19 @@ android { flavorDimensions "abi" productFlavors { // replace the libraries with 64-bit versions when they're ready - arm { dimension "abi" } - x86 { dimension "abi" } + // Processor architectures + arm { + dimension "abi" + ndk { + abiFilter "armeabi-v7a" + } + } + x86 { + dimension "abi" + ndk { + abiFilter "x86" + } + } } compileOptions {