-
Notifications
You must be signed in to change notification settings - Fork 1.5k
/
build.gradle
75 lines (64 loc) · 2.55 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
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 {
mavenCentral()
google()
}
def buildGradleVersion = ext.has('buildGradlePluginVersion') ? ext.get('buildGradlePluginVersion') : '4.2.0'
dependencies {
classpath "com.android.tools.build:gradle:$buildGradleVersion"
}
}
}
apply plugin: 'com.android.library'
def safeExtGet(prop, fallback) {
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}
android {
compileSdkVersion safeExtGet('compileSdkVersion', 34)
def agpVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION
// Check AGP version for backward compatibility reasons
if (agpVersion.tokenize('.')[0].toInteger() >= 7) {
namespace = "com.learnium.RNDeviceInfo"
}
defaultConfig {
minSdkVersion safeExtGet('minSdkVersion', 16)
targetSdkVersion safeExtGet('targetSdkVersion', 28)
versionCode 2
versionName "1.1"
}
lintOptions {
warning 'InvalidPackage', 'MissingPermission'
}
testOptions {
unitTests.returnDefaultValues = true
}
}
repositories {
mavenCentral()
google()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
}
dependencies {
implementation "com.facebook.react:react-native:${safeExtGet('reactNativeVersion', '+')}"
implementation "com.android.installreferrer:installreferrer:${safeExtGet('installReferrerVersion', '1.1.2')}"
def firebaseBomVersion = safeExtGet("firebaseBomVersion", null)
def firebaseIidVersion = safeExtGet('firebaseIidVersion', null)
def googlePlayServicesIidVersion = safeExtGet('googlePlayServicesIidVersion', null)
if (firebaseBomVersion) {
implementation platform("com.google.firebase:firebase-bom:${firebaseBomVersion}")
implementation "com.google.firebase:firebase-iid"
} else if(firebaseIidVersion){
implementation "com.google.firebase:firebase-iid:${firebaseIidVersion}"
} else if(googlePlayServicesIidVersion){
implementation "com.google.android.gms:play-services-iid:$googlePlayServicesIidVersion"
}
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0'
testImplementation "org.mockito:mockito-core:3.6.28"
}