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,13 +1,21 @@
1 1
 apply plugin: 'com.android.library'
2 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 13
 android {
5
-    compileSdkVersion 26
6
-    buildToolsVersion '27.0.3'
14
+    compileSdkVersion safeExtGet('compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION)
7 15
 
8 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 19
         versionCode 1
12 20
         versionName "1.0"
13 21
     }
@@ -81,11 +89,13 @@ allprojects { p ->
81 89
     }
82 90
 }
83 91
 
92
+def supportLibVersion = safeExtGet('supportLibVersion', DEFAULT_SUPPORT_LIB_VERSION)
93
+
84 94
 dependencies {
85 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 100
     implementation 'com.github.wix-playground:ahbottomnavigation:2.4.9'
91 101
     implementation 'com.github.wix-playground:reflow-animator:1.0.4'