Skip to content

Commit 8b147dd

Browse files
committed
Using SDK Version variables from root project
Instead of assuming the `compileSdkVersion`, `targetSdkVersion`, etc, read it from the root project. Default `compileSdkVersion` and `targetSdkVersion` to the latest versions. Android Target API Level 26 will be required in August 2018. https://android-developers.googleblog.com/2017/12/improving-app-security-and-performance.html And the React Native team is already working on this: facebook/react-native#17741 facebook/react-native#18095
1 parent 1ec6c3f commit 8b147dd

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

android/build.gradle

+18-6
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,32 @@
11
apply plugin: 'com.android.library'
22

3+
def _ext = rootProject.ext
4+
5+
def _reactNativeVersion = _ext.has('reactNative') ? _ext.reactNative : '+'
6+
def _compileSdkVersion = _ext.has('compileSdkVersion') ? _ext.compileSdkVersion : 27
7+
def _buildToolsVersion = _ext.has('buildToolsVersion') ? _ext.buildToolsVersion : '27.0.3'
8+
def _minSdkVersion = _ext.has('minSdkVersion') ? _ext.minSdkVersion : 16
9+
def _targetSdkVersion = _ext.has('targetSdkVersion') ? _ext.targetSdkVersion : 27
10+
311
android {
4-
compileSdkVersion 25
5-
buildToolsVersion "25.0.2"
12+
compileSdkVersion _compileSdkVersion
13+
buildToolsVersion _buildToolsVersion
614

715
defaultConfig {
8-
minSdkVersion 16
9-
targetSdkVersion 22
16+
minSdkVersion _minSdkVersion
17+
targetSdkVersion _targetSdkVersion
1018
versionCode 1
1119
versionName "1.0"
1220
ndk {
1321
abiFilters "armeabi-v7a", "x86"
1422
}
1523
}
24+
lintOptions {
25+
abortOnError false
26+
}
1627
}
1728

1829
dependencies {
19-
compile 'com.facebook.react:react-native:+'
20-
}
30+
//noinspection GradleDynamicVersion
31+
compile "com.facebook.react:react-native:${_reactNativeVersion}"
32+
}

0 commit comments

Comments
 (0)