Skip to content

Commit

Permalink
Merge pull request #17 from SaeedZhiany/patch-1
Browse files Browse the repository at this point in the history
Improved Gradle setup
  • Loading branch information
faizalshap authored Apr 29, 2020
2 parents 485a767 + 5a9a621 commit 10dc729
Showing 1 changed file with 20 additions and 22 deletions.
42 changes: 20 additions & 22 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,29 +1,31 @@
buildscript {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
// The Android Gradle plugin is only required when opening the android folder stand-alone.
// This avoids unnecessary downloads and potential conflicts when the library is included as a
// module dependency in an application project.
if (project == rootProject) {
repositories {
google()
jcenter()
}
}

dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
dependencies {
classpath("com.android.tools.build:gradle:3.6.1")
}
}
}

apply plugin: 'com.android.library'
def DEFAULT_COMPILE_SDK_VERSION = 26
def DEFAULT_BUILD_TOOLS_VERSION = "28.0.2"
def DEFAULT_TARGET_SDK_VERSION = 26
def DEFAULT_GOOGLE_PLAY_SERVICES_VERSION = "+"

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

android {
compileSdkVersion project.hasProperty('compileSdkVersion') ? project.compileSdkVersion : DEFAULT_COMPILE_SDK_VERSION
buildToolsVersion project.hasProperty('buildToolsVersion') ? project.buildToolsVersion : DEFAULT_BUILD_TOOLS_VERSION
compileSdkVersion safeExtGet('compileSdkVersion', 28)

defaultConfig {
minSdkVersion 16
targetSdkVersion project.hasProperty('targetSdkVersion') ? project.targetSdkVersion : DEFAULT_TARGET_SDK_VERSION
minSdkVersion safeExtGet('minSdkVersion', 16)
targetSdkVersion safeExtGet('targetSdkVersion', 28)
versionCode 1
versionName "1.0"
}
Expand All @@ -35,15 +37,11 @@ android {
repositories {
mavenCentral()
google()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}

dependencies {
def googlePlayServicesVersion = project.hasProperty('googlePlayServicesVersion') ? project.googlePlayServicesVersion
: project.hasProperty('playServiceVersion') ? project.playServiceVersion : DEFAULT_GOOGLE_PLAY_SERVICES_VERSION
def googlePlayServicesVersion = safeExtGet('googlePlayServicesVersion', safeExtGet('playServiceVersion', '+'))

implementation 'com.facebook.react:react-native:+'
implementation "com.google.android.gms:play-services-auth:$googlePlayServicesVersion"
}

0 comments on commit 10dc729

Please sign in to comment.