Skip to content

Commit 0b78730

Browse files
hyochanmaicki
authored andcommitted
Better setup for android build version. (#67)
* Better setup for android build version. React Native now has its project set up with default build version of androids sdk. Set android build version to that ofrootProjet``s to prevent from build failing cause of version mismatch. * Safer build config for android. Support older react-native version.
1 parent e5ad354 commit 0b78730

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

templates/android.js

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,24 @@ buildscript {
1616
apply plugin: 'com.android.library'
1717
apply plugin: 'maven'
1818
19-
android {
20-
compileSdkVersion 23
21-
buildToolsVersion "23.0.1"
19+
def DEFAULT_COMPILE_SDK_VERSION = 27
20+
def DEFAULT_BUILD_TOOLS_VERSION = "27.0.3"
21+
def DEFAULT_MIN_SDK_VERSION = 16
22+
def DEFAULT_TARGET_SDK_VERSION = 26
2223
23-
defaultConfig {
24-
minSdkVersion 16
25-
targetSdkVersion 22
26-
versionCode 1
27-
versionName "1.0"
28-
}
29-
lintOptions {
30-
abortOnError false
31-
}
24+
android {
25+
compileSdkVersion rootProject.ext.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : DEFAULT_COMPILE_SDK_VERSION
26+
buildToolsVersion rootProject.ext.hasProperty('buildToolsVersion') ? rootProject.ext.buildToolsVersion : DEFAULT_BUILD_TOOLS_VERSION
27+
28+
defaultConfig {
29+
minSdkVersion rootProject.ext.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : DEFAULT_MIN_SDK_VERSION
30+
targetSdkVersion rootProject.ext.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : DEFAULT_TARGET_SDK_VERSION
31+
versionCode 1
32+
versionName "1.0"
33+
}
34+
lintOptions {
35+
abortOnError false
36+
}
3237
}
3338
3439
repositories {

0 commit comments

Comments
 (0)