Skip to content

Commit bbdfd33

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 e891ca9 commit bbdfd33

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

android/build.gradle

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,26 @@ buildscript {
99

1010
apply plugin: 'com.android.library'
1111

12+
def _ext = rootProject.ext
13+
14+
def _reactNativeVersion = _ext.has('reactNative') ? _ext.reactNative : '+'
15+
def _compileSdkVersion = _ext.has('compileSdkVersion') ? _ext.compileSdkVersion : 27
16+
def _buildToolsVersion = _ext.has('buildToolsVersion') ? _ext.buildToolsVersion : '27.0.3'
17+
def _minSdkVersion = _ext.has('minSdkVersion') ? _ext.minSdkVersion : 16
18+
def _targetSdkVersion = _ext.has('targetSdkVersion') ? _ext.targetSdkVersion : 27
19+
1220
android {
13-
compileSdkVersion 23
14-
buildToolsVersion "23.0.1"
21+
compileSdkVersion _compileSdkVersion
22+
buildToolsVersion _buildToolsVersion
1523

1624
defaultConfig {
17-
minSdkVersion 16
18-
targetSdkVersion 22
25+
minSdkVersion _minSdkVersion
26+
targetSdkVersion _targetSdkVersion
1927
versionCode 1
2028
versionName "1.0"
21-
lintOptions {
22-
abortOnError false
23-
}
29+
}
30+
lintOptions {
31+
abortOnError false
2432
}
2533
}
2634

@@ -29,8 +37,9 @@ repositories {
2937
}
3038

3139
dependencies {
32-
compile 'com.facebook.react:react-native:+'
40+
//noinspection GradleDynamicVersion
41+
compile "com.facebook.react:react-native:${_reactNativeVersion}"
3342
compile group: 'com.github.bumptech.glide', name: 'glide', version: '3.8.0'
3443
compile group: 'com.github.bumptech.glide', name: 'okhttp3-integration', version: '1.5.0'
35-
compile 'com.android.support:support-v4:19.1.0'
44+
compile "com.android.support:support-v4:${_compileSdkVersion}.+"
3645
}

0 commit comments

Comments
 (0)