Skip to content

Commit

Permalink
Using SDK Version variables from root project (#714)
Browse files Browse the repository at this point in the history
* 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

* Renaming variables for consistency

* Rename variables and use *Version for all settings
  • Loading branch information
rayronvictor authored and oblador committed Jul 20, 2018
1 parent e6b0e06 commit cfb58ca
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,21 @@ buildscript {

apply plugin: 'com.android.library'

def ext = rootProject.ext

def projectReactNativeVersion = ext.has('reactNativeVersion') ? ext.reactNativeVersion : '+'
def projectCompileSdkVersion = ext.has('compileSdkVersion') ? ext.compileSdkVersion : 27
def projectBuildToolsVersion = ext.has('buildToolsVersion') ? ext.buildToolsVersion : '27.0.3'
def projectMinSdkVersion = ext.has('minSdkVersion') ? ext.minSdkVersion : 16
def projectTargetSdkVersion = ext.has('targetSdkVersion') ? ext.targetSdkVersion : 27

android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
compileSdkVersion projectCompileSdkVersion
buildToolsVersion projectBuildToolsVersion

defaultConfig {
minSdkVersion 16
targetSdkVersion 26
minSdkVersion projectMinSdkVersion
targetSdkVersion projectTargetSdkVersion
versionCode 1
versionName "1.0"
}
Expand All @@ -30,5 +38,5 @@ repositories {
}

dependencies {
compile "com.facebook.react:react-native:+"
compile "com.facebook.react:react-native:${projectReactNativeVersion}"
}

0 comments on commit cfb58ca

Please sign in to comment.