Browse Source

Fix dependency incompatibility

Old config called `Android dependency 'com.android.support:support-v4' has different version for the compile (26.1.0) and runtime (27.1.1) classpath. You should manually set the same version via DependencyResolution` error, this PR has fixed this
Folleah 5 years ago
parent
commit
5610ebbafe
No account linked to committer's email address
1 changed files with 10 additions and 7 deletions
  1. 10
    7
      android/build.gradle

+ 10
- 7
android/build.gradle View File

1
+def safeExtGet(prop, fallback) {
2
+    rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
3
+}
4
+
1
 buildscript {
5
 buildscript {
2
     /* In case of submodule usage, do not try to apply own repositories and plugins,
6
     /* In case of submodule usage, do not try to apply own repositories and plugins,
3
         root project is responsible for that. */
7
         root project is responsible for that. */
15
 apply plugin: 'com.android.library'
19
 apply plugin: 'com.android.library'
16
 
20
 
17
 android {
21
 android {
18
-    compileSdkVersion 27
19
-    buildToolsVersion "28.0.3"
22
+    compileSdkVersion safeExtGet('compileSdkVersion', 27)
23
+    buildToolsVersion safeExtGet('buildToolsVersion', '28.0.3')
20
 
24
 
21
     defaultConfig {
25
     defaultConfig {
22
-        minSdkVersion 16
23
-        targetSdkVersion 27
26
+        minSdkVersion safeExtGet('minSdkVersion', 16)
27
+        targetSdkVersion safeExtGet('targetSdkVersion', 27)
24
 
28
 
25
         versionCode 1
29
         versionCode 1
26
         versionName "1.0"
30
         versionName "1.0"
42
 }
46
 }
43
 
47
 
44
 dependencies {
48
 dependencies {
45
-    implementation 'com.android.support:support-v4:27.+'
46
-
49
+    implementation "com.android.support:support-v4:${safeExtGet('supportLibVersion', '27.+')}"
47
     api 'com.facebook.react:react-native:+'
50
     api 'com.facebook.react:react-native:+'
48
-}
51
+}