react-native-inappbrowser/android/build.gradle
SaeedZhiany 298aa325ec
Update build.gradle
Load Android Gradle Plugin conditionally
2019-10-21 09:28:02 +03:30

68 lines
2.2 KiB
Groovy

apply plugin: 'com.android.library'
buildscript {
// 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 {
maven { url "https://maven.google.com" }
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.1'
}
}
}
def safeExtGet(prop, fallback) {
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}
def DEFAULT_COMPILE_SDK_VERSION = 28
def DEFAULT_BUILD_TOOLS_VERSION = "28.0.3"
def DEFAULT_MIN_SDK_VERSION = 16
def DEFAULT_TARGET_SDK_VERSION = 28
android {
compileSdkVersion safeExtGet('compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION)
buildToolsVersion safeExtGet('buildToolsVersion', DEFAULT_BUILD_TOOLS_VERSION)
defaultConfig {
minSdkVersion safeExtGet('minSdkVersion', DEFAULT_MIN_SDK_VERSION)
targetSdkVersion safeExtGet('targetSdkVersion', DEFAULT_TARGET_SDK_VERSION)
versionCode 1
versionName "1.0"
}
lintOptions {
abortOnError false
}
}
repositories {
mavenCentral()
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.facebook.react:react-native:+'
implementation 'org.greenrobot:eventbus:3.+'
def supportLibVersion = safeExtGet('supportLibVersion', safeExtGet('supportVersion', null))
def androidXVersion = safeExtGet('androidXVersion', null)
if (supportLibVersion && androidXVersion == null) {
implementation "com.android.support:support-annotations:$supportLibVersion"
implementation "com.android.support:customtabs:$supportLibVersion"
} else {
def defaultAndroidXVersion = "1.+"
if (androidXVersion == null) {
androidXVersion = defaultAndroidXVersion
}
def androidXAnnotation = safeExtGet('androidXAnnotation', androidXVersion)
def androidXBrowser = safeExtGet('androidXBrowser', androidXVersion)
implementation "androidx.annotation:annotation:$androidXAnnotation"
implementation "androidx.browser:browser:$androidXBrowser"
}
}