Skip to content
This repository was archived by the owner on Jan 14, 2025. It is now read-only.

Commit 1e3525f

Browse files
authored
Merge pull request #1036 from pro-nasa/patch-1
Update and standardization build.gradle
2 parents ae4f9fd + 798093c commit 1e3525f

File tree

1 file changed

+14
-21
lines changed

1 file changed

+14
-21
lines changed

android/build.gradle

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,17 @@ allprojects {
1515

1616
apply plugin: 'com.android.library'
1717

18-
def DEFAULT_COMPILE_SDK_VERSION = 27
19-
def DEFAULT_BUILD_TOOLS_VERSION = "27.0.3"
20-
def DEFAULT_TARGET_SDK_VERSION = 27
21-
def DEFAULT_SUPPORT_LIB_VERSION = "27.1.1"
22-
def DEFAULT_GOOGLE_PLAY_SERVICES_VERSION = "+"
23-
def DEFAULT_FIREBASE_MESSAGING_VERSION = "+"
18+
def safeExtGet(prop, fallback) {
19+
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
20+
}
2421

2522
android {
26-
compileSdkVersion project.hasProperty('compileSdkVersion') ? project.compileSdkVersion : DEFAULT_COMPILE_SDK_VERSION
27-
buildToolsVersion project.hasProperty('buildToolsVersion') ? project.buildToolsVersion : DEFAULT_BUILD_TOOLS_VERSION
23+
compileSdkVersion safeExtGet('compileSdkVersion', 28)
24+
buildToolsVersion safeExtGet('buildToolsVersion', '28.0.3')
2825

2926
defaultConfig {
30-
minSdkVersion 16
31-
targetSdkVersion project.hasProperty('targetSdkVersion') ? project.targetSdkVersion : DEFAULT_TARGET_SDK_VERSION
27+
minSdkVersion safeExtGet('minSdkVersion', 16)
28+
targetSdkVersion safeExtGet('targetSdkVersion', 28)
3229
versionCode 1
3330
versionName "1.0"
3431
ndk {
@@ -44,15 +41,11 @@ android {
4441
}
4542

4643
dependencies {
47-
def supportLibVersion = project.hasProperty('supportLibVersion') ? project.supportLibVersion : DEFAULT_SUPPORT_LIB_VERSION
48-
def googlePlayServicesVersion = project.hasProperty('googlePlayServicesVersion') ? project.googlePlayServicesVersion : DEFAULT_GOOGLE_PLAY_SERVICES_VERSION
49-
def firebaseVersion = project.hasProperty('firebaseVersion') ? project.firebaseVersion : DEFAULT_FIREBASE_MESSAGING_VERSION
50-
51-
compile fileTree(dir: 'libs', include: ['*.jar'])
52-
testCompile 'junit:junit:4.12'
53-
compile "com.android.support:appcompat-v7:$supportLibVersion"
54-
compile 'com.facebook.react:react-native:+'
55-
compile "com.google.android.gms:play-services-gcm:$googlePlayServicesVersion"
56-
compile 'me.leolin:ShortcutBadger:1.1.8@aar'
57-
compile "com.google.firebase:firebase-messaging:$firebaseVersion"
44+
implementation fileTree(dir: 'libs', include: ['*.jar'])
45+
testImplementation 'junit:junit:4.12'
46+
implementation "com.android.support:appcompat-v7:${safeExtGet('supportLibVersion', '28.0.0')}"
47+
implementation "com.facebook.react:react-native:${safeExtGet('reactNativeVersion', '+')}"
48+
implementation "com.google.android.gms:play-services-gcm:${safeExtGet('googlePlayServicesVersion', '+')}"
49+
implementation 'me.leolin:ShortcutBadger:1.1.8@aar'
50+
implementation "com.google.firebase:firebase-messaging:${safeExtGet('firebaseVersion', '+')}"
5851
}

0 commit comments

Comments
 (0)