@@ -12,7 +12,12 @@ buildscript {
12
12
apply plugin : ' com.android.library'
13
13
14
14
def _nodeTargetSdkVersion = ((rootProject?. ext?. properties?. targetSdkVersion) ?: 22 )
15
-
15
+ def _nodeMinSdkVersion = ((rootProject?. ext?. properties?. minSdkVersion) ?: 16 )
16
+ def _compileNativeModulesSdkVersion = _nodeMinSdkVersion;
17
+ if (_compileNativeModulesSdkVersion< 21 ) {
18
+ // 21 is the minimum sdk version Node is built with.
19
+ _compileNativeModulesSdkVersion= 21 ;
20
+ }
16
21
def DoesAppAlreadyDefineWantedSTL () {
17
22
// Since react-native 0.59.0, the Application already defines libc++_shared as the APP_STL.
18
23
// Defining it also in this plugin would lead to a build error when merging assets.
@@ -47,7 +52,7 @@ android {
47
52
buildToolsVersion ((rootProject?. ext?. properties?. buildToolsVersion) ?: " 23.0.1" )
48
53
49
54
defaultConfig {
50
- minSdkVersion ((rootProject ?. ext ?. properties ?. minSdkVersion) ?: 16 )
55
+ minSdkVersion _nodeMinSdkVersion
51
56
targetSdkVersion _nodeTargetSdkVersion
52
57
versionCode 1
53
58
versionName " 1.0"
@@ -336,7 +341,7 @@ if ("1".equals(shouldRebuildNativeModules)) {
336
341
task " MakeToolchain${ abi_name} " (type :Exec ) {
337
342
description = " Building a native toolchain to compile nodejs-mobile native modules for ${ abi_name} ."
338
343
executable = " ${ ndk_bundle_path} /build/tools/make-standalone-toolchain.sh"
339
- args " --toolchain=${ temp_toolchain_name} -${ temp_cc_ver} " , " --arch=${ temp_arch} " , " --install-dir=${ standalone_toolchain} " , " --stl=libc++" , " --force" , " --platform=android-${ _nodeTargetSdkVersion } "
344
+ args " --toolchain=${ temp_toolchain_name} -${ temp_cc_ver} " , " --arch=${ temp_arch} " , " --install-dir=${ standalone_toolchain} " , " --stl=libc++" , " --force" , " --platform=android-${ _compileNativeModulesSdkVersion } "
340
345
outputs. file " ${ standalone_toolchain} "
341
346
}
342
347
0 commit comments