Skip to content

Commit 28bfb40

Browse files
authored
Merge pull request #117 from SaeedZhiany/patch-1
fixed Gradle setup
2 parents c86ede4 + aa7a768 commit 28bfb40

File tree

1 file changed

+18
-15
lines changed

1 file changed

+18
-15
lines changed

android/build.gradle

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,32 @@ apply plugin: 'com.android.library'
22

33
description = 'react-native-biometrics'
44

5-
def DEFAULT_COMPILE_SDK_VERSION = 29
6-
def DEFAULT_BUILD_TOOLS_VERSION = "29.0.2"
7-
def DEFAULT_MIN_SDK_VERSION = 16
8-
def DEFAULT_TARGET_SDK_VERSION = 29
9-
105
buildscript {
11-
repositories {
12-
google()
13-
jcenter()
6+
// The Android Gradle plugin is only required when opening the android folder stand-alone.
7+
// This avoids unnecessary downloads and potential conflicts when the library is included as a
8+
// module dependency in an application project.
9+
if (project == rootProject) {
10+
repositories {
11+
google()
12+
jcenter()
13+
}
14+
15+
dependencies {
16+
classpath("com.android.tools.build:gradle:3.6.2")
17+
}
1418
}
19+
}
1520

16-
dependencies {
17-
classpath 'com.android.tools.build:gradle:3.4.2'
18-
}
21+
def safeExtGet(prop, fallback) {
22+
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
1923
}
2024

2125
android {
22-
compileSdkVersion rootProject.hasProperty('compileSdkVersion') ? rootProject.compileSdkVersion : DEFAULT_COMPILE_SDK_VERSION
23-
buildToolsVersion rootProject.hasProperty('buildToolsVersion') ? rootProject.buildToolsVersion : DEFAULT_BUILD_TOOLS_VERSION
26+
compileSdkVersion safeExtGet('compileSdkVersion', 29)
2427

2528
defaultConfig {
26-
minSdkVersion rootProject.hasProperty('minSdkVersion') ? rootProject.minSdkVersion : DEFAULT_MIN_SDK_VERSION
27-
targetSdkVersion rootProject.hasProperty('targetSdkVersion') ? rootProject.targetSdkVersion : DEFAULT_TARGET_SDK_VERSION
29+
minSdkVersion safeExtGet('minSdkVersion', 16)
30+
targetSdkVersion safeExtGet('targetSdkVersion', 29)
2831
}
2932
lintOptions {
3033
abortOnError false

0 commit comments

Comments
 (0)