Skip to content

Commit 2cd5d85

Browse files
authored
Update build.gradle
Manually merge this PR mauritsd#7 to fix android version problem
1 parent 910cb06 commit 2cd5d85

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

android/build.gradle

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
apply plugin: 'com.android.library'
12

23
buildscript {
34
repositories {
@@ -9,15 +10,22 @@ buildscript {
910
}
1011
}
1112

12-
apply plugin: 'com.android.library'
13+
def safeExtGet(prop, fallback) {
14+
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
15+
}
16+
17+
def DEFAULT_COMPILE_SDK_VERSION = 23
18+
def DEFAULT_BUILD_TOOLS_VERSION = "23.0.1"
19+
def DEFAULT_MIN_SDK_VERSION = 16
20+
def DEFAULT_TARGET_SDK_VERSION = 22
1321

1422
android {
15-
compileSdkVersion 23
16-
buildToolsVersion "23.0.1"
23+
compileSdkVersion safeExtGet('compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION)
24+
buildToolsVersion safeExtGet('buildToolsVersion', DEFAULT_BUILD_TOOLS_VERSION)
1725

1826
defaultConfig {
19-
minSdkVersion 16
20-
targetSdkVersion 22
27+
minSdkVersion safeExtGet('minSdkVersion', DEFAULT_MIN_SDK_VERSION)
28+
targetSdkVersion safeExtGet('targetSdkVersion', DEFAULT_TARGET_SDK_VERSION)
2129
versionCode 1
2230
versionName "1.0"
2331
}
@@ -31,5 +39,5 @@ repositories {
3139
}
3240

3341
dependencies {
34-
compile 'com.facebook.react:react-native:+'
42+
implementation 'com.facebook.react:react-native:+'
3543
}

0 commit comments

Comments
 (0)