Skip to content

Commit

Permalink
android: always specify abiFilter if not set
Browse files Browse the repository at this point in the history
Specifies abiFilter to the supported architectures if it's not set.
This enables the plugin to be used on older versions of
cordova-android that might try to build unsupported architectures.
  • Loading branch information
jaimecbernardo committed Mar 14, 2019
1 parent 22d606d commit bc3c596
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ android {
}
}

if (android.defaultConfig.ndk.abiFilters == null) {
// No abiFilter is defined for the build. Set it to the supported architectures.
logger.warn("nodejs-mobile-cordova detected no ABI filters were set. Will use [\"armeabi-v7a\", \"x86\", \"arm64-v8a\", \"x86_64\"].");
android.defaultConfig.ndk.abiFilters = ["armeabi-v7a", "x86", "arm64-v8a", "x86_64"] as Set<String>;
}

cdvPluginPostBuildExtras += { ->
// gzip files will cause errors with aapt. Remove them for improved npm compatibility.
android.aaptOptions.ignoreAssetsPattern += ":!*.gz";
Expand Down Expand Up @@ -101,13 +107,7 @@ if ("1".equals(shouldRebuildNativeModules)) {
}
}

def nativeModulesABIs = android.defaultConfig.ndk.abiFilters;
if (nativeModulesABIs == null) {
// No abiFilter is defined for the build. Build native modules for every architecture.
nativeModulesABIs = ["armeabi-v7a", "x86", "arm64-v8a", "x86_64"] as Set<String>;
}

nativeModulesABIs.each { abi_name ->
android.defaultConfig.ndk.abiFilters.each { abi_name ->
String temp_arch = {
switch (abi_name) {
case 'armeabi-v7a':
Expand Down

0 comments on commit bc3c596

Please sign in to comment.