UNPKG

2.13 kBPlain TextView Raw
1buildscript {
2 // The Android Gradle plugin is only required when opening the android folder stand-alone.
3 // This avoids unnecessary downloads and potential conflicts when the library is included as a
4 // module dependency in an application project.
5 if (project == rootProject) {
6 repositories {
7 google()
8 jcenter()
9 }
10
11 dependencies {
12 classpath("com.android.tools.build:gradle:3.6.3")
13 }
14 }
15}
16
17def getExtOrInitialValue(name, initialValue) {
18 return rootProject.ext.has(name) ? rootProject.ext.get(name) : initialValue
19}
20
21def getExtOrDefault(name) {
22 return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['ReactNativeNetInfo_' + name]
23}
24
25def getExtOrIntegerDefault(name) {
26 return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties['ReactNativeNetInfo_' + name]).toInteger()
27}
28
29apply plugin: 'com.android.library'
30
31android {
32 compileSdkVersion getExtOrIntegerDefault('compileSdkVersion')
33
34 defaultConfig {
35 minSdkVersion getExtOrIntegerDefault('minSdkVersion')
36 targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
37 }
38 lintOptions{
39 abortOnError false
40 }
41}
42
43repositories {
44 maven {
45 // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
46 url "$rootDir/../node_modules/react-native/android"
47 }
48 google()
49 jcenter()
50 mavenCentral()
51}
52
53dependencies {
54 //noinspection GradleDynamicVersion
55 implementation 'com.facebook.react:react-native:+'
56
57 def supportLibVersion = getExtOrInitialValue('supportLibVersion', getExtOrInitialValue('supportVersion', null))
58 def androidXVersion = getExtOrInitialValue('androidXVersion', null)
59 def androidXCore = getExtOrInitialValue('androidXCore', null)
60 if (supportLibVersion && androidXVersion == null && androidXCore == null) {
61 implementation "com.android.support:appcompat-v7:$supportLibVersion"
62 } else {
63 def defaultAndroidXVersion = "1.3.2"
64 if (androidXCore == null) {
65 androidXCore = androidXVersion == null ? defaultAndroidXVersion : androidXVersion
66 }
67 implementation "androidx.core:core:$androidXCore"
68 }
69}