Skip to content

Commit

Permalink
improved SDK values -use SDK Version values from root project
Browse files Browse the repository at this point in the history
Instead of assuming the `compileSdkVersion `, `targetSdkVersion`, etc, we can make it dynamic by reading it from the root project.


Android Target API Level 26 will be required in August 2018.
https://android-developers.googleblog.com/2017/12/improving-app-security-and-performance.html

Therefore I wrote target values of 26 instead of 23

And the React Native team is already working on this:
facebook/react-native#18095
facebook/react-native#17741
  • Loading branch information
yeomann authored Jul 24, 2018
1 parent b308231 commit 385ed2f
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,19 @@ buildscript {

apply plugin: 'com.android.library'

def safeExtGet(prop, fallback) {
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}

android {
compileSdkVersion 23
compileSdkVersion safeExtGet('compileSdkVersion', 26)
//noinspection GradleDependency
buildToolsVersion "23.0.1"
buildToolsVersion safeExtGet('buildToolsVersion', '26.0.3')

defaultConfig {
minSdkVersion 16
minSdkVersion safeExtGet('minSdkVersion', 16)
//noinspection OldTargetApi
targetSdkVersion 22
targetSdkVersion safeExtGet('targetSdkVersion', 26)
versionCode 1
versionName "1.0"
}
Expand All @@ -39,5 +43,5 @@ repositories {

dependencies {
//noinspection GradleDynamicVersion
compile 'com.facebook.react:react-native:+'
compile "com.facebook.react:react-native:${safeExtGet('reactNativeVersion', '+')}"
}

0 comments on commit 385ed2f

Please sign in to comment.