Browse Source

Match android dependencies to app configuration (#4925)

Fixes #4524
Alpha 5 years ago
parent
commit
e954a41e64
1 changed files with 17 additions and 7 deletions
  1. 17
    7
      lib/android/app/build.gradle

+ 17
- 7
lib/android/app/build.gradle View File

1
 apply plugin: 'com.android.library'
1
 apply plugin: 'com.android.library'
2
 apply from: '../prepare-robolectric.gradle'
2
 apply from: '../prepare-robolectric.gradle'
3
 
3
 
4
+def safeExtGet(prop, fallback) {
5
+    rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
6
+}
7
+
8
+def DEFAULT_COMPILE_SDK_VERSION = 26
9
+def DEFAULT_MIN_SDK_VERSION = 19
10
+def DEFAULT_SUPPORT_LIB_VERSION = '26.1.0'
11
+def DEFAULT_TARGET_SDK_VERSION = 25
12
+
4
 android {
13
 android {
5
-    compileSdkVersion 26
6
-    buildToolsVersion '27.0.3'
14
+    compileSdkVersion safeExtGet('compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION)
7
 
15
 
8
     defaultConfig {
16
     defaultConfig {
9
-        minSdkVersion 19
10
-        targetSdkVersion 25
17
+        minSdkVersion safeExtGet('minSdkVersion', DEFAULT_MIN_SDK_VERSION)
18
+        targetSdkVersion safeExtGet('targetSdkVersion', DEFAULT_TARGET_SDK_VERSION)
11
         versionCode 1
19
         versionCode 1
12
         versionName "1.0"
20
         versionName "1.0"
13
     }
21
     }
81
     }
89
     }
82
 }
90
 }
83
 
91
 
92
+def supportLibVersion = safeExtGet('supportLibVersion', DEFAULT_SUPPORT_LIB_VERSION)
93
+
84
 dependencies {
94
 dependencies {
85
     implementation fileTree(include: ['*.jar'], dir: 'libs')
95
     implementation fileTree(include: ['*.jar'], dir: 'libs')
86
-    implementation 'com.android.support:design:26.1.0'
87
-    implementation 'com.android.support:appcompat-v7:26.1.0'
88
-    implementation 'com.android.support:support-v4:26.1.0'
96
+    implementation "com.android.support:design:${supportLibVersion}"
97
+    implementation "com.android.support:appcompat-v7:${supportLibVersion}"
98
+    implementation "com.android.support:support-v4:${supportLibVersion}"
89
 
99
 
90
     implementation 'com.github.wix-playground:ahbottomnavigation:2.4.9'
100
     implementation 'com.github.wix-playground:ahbottomnavigation:2.4.9'
91
     implementation 'com.github.wix-playground:reflow-animator:1.0.4'
101
     implementation 'com.github.wix-playground:reflow-animator:1.0.4'