Browse Source

Document support library version mismatch

Closes #3414
Closes #3412
Guy Carmeli 6 years ago
parent
commit
f3d7df0121
1 changed files with 44 additions and 9 deletions
  1. 44
    9
      docs/docs/Installing.md

+ 44
- 9
docs/docs/Installing.md View File

@@ -47,14 +47,14 @@
47 47
 
48 48
 > Make sure your Android Studio installation is updated. We recommend editing `gradle` and `java` files in Android Studio as the IDE will suggest fixes and point out errors, this way you avoid most common pitfalls.
49 49
 
50
-1. Add the following in `android/settings.gradle`:
50
+### 1. Add the following in `android/settings.gradle`:
51 51
 
52 52
 	```groovy
53 53
 	include ':react-native-navigation'
54 54
 	project(':react-native-navigation').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-navigation/lib/android/app/')
55 55
 	```
56 56
 
57
-2. Update `android/build.gradle`:
57
+### 2. Update `android/build.gradle`:
58 58
 
59 59
 	```diff
60 60
 	buildscript {
@@ -84,7 +84,7 @@
84 84
 	}
85 85
 	```
86 86
 
87
-3. Update project dependencies in `android/app/build.gradle`.
87
+### 3. Update project dependencies in `android/app/build.gradle`.
88 88
 
89 89
 	```groovy
90 90
 	android {
@@ -123,7 +123,7 @@
123 123
 ><br>with:<br>
124 124
 >`missingDimensionStrategy "RNN.reactNativeVersion", "reactNative55"`
125 125
 
126
-4. Make sure you're using the new gradle plugin, edit `android/gradle/wrapper/gradle-wrapper.properties`
126
+### 4. Make sure you're using the new gradle plugin, edit `android/gradle/wrapper/gradle-wrapper.properties`
127 127
 
128 128
 	```diff
129 129
 	distributionBase=GRADLE_USER_HOME
@@ -134,14 +134,14 @@
134 134
 	-distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
135 135
 	```
136 136
 
137
-5. Update `gradle.properties` and disable incremental resource processing
137
+### 5. Update `gradle.properties` and disable incremental resource processing
138 138
 
139 139
 	```diff
140 140
 	+# Disable incremental resource processing as it broke relase build
141 141
 	+android.enableAapt2=false
142 142
 	```
143 143
 
144
-6. In `MainActivity.java` it should extend `com.reactnativenavigation.NavigationActivity` instead of `ReactActivity`.
144
+### 6. In `MainActivity.java` it should extend `com.reactnativenavigation.NavigationActivity` instead of `ReactActivity`.
145 145
 
146 146
 	This file can be located in `android/app/src/main/java/com/yourproject/`.
147 147
 
@@ -155,7 +155,7 @@
155 155
 
156 156
 	If you have any **react-native** related methods, you can safely delete them.
157 157
 
158
-7. In `MainApplication.java`, add the following
158
+### 7. In `MainApplication.java`, add the following
159 159
 	
160 160
 	```java
161 161
 	import com.reactnativenavigation.NavigationApplication;
@@ -176,11 +176,46 @@
176 176
 	```
177 177
     Make sure that `isDebug` method is implemented.
178 178
 
179
-8. Update `AndroidManifest.xml` and set `application` **android:name** value to `.MainApplication`
180
-	
179
+### 8. Update `AndroidManifest.xml` and set `application` **android:name** value to `.MainApplication`
180
+
181 181
 	```xml
182 182
 	<application
183 183
 		android:name=".MainApplication"
184 184
 		...
185 185
 	/>
186 186
 	```
187
+### 9. Force the same support library version across all dependencies
188
+
189
+Some of your dependencies might require a different version of one of Google's support library packages. This results in compilation errors similar to this:
190
+
191
+```
192
+FAILURE: Build failed with an exception.
193
+
194
+* What went wrong:
195
+Execution failed for task ':app:preDebugBuild'.
196
+> Android dependency 'com.android.support:design' has different version for the compile (25.4.0) and runtime (26.1.0) classpath. You should manually set the same version via DependencyResolution
197
+```
198
+
199
+To resolve these conflicts, add the following to your `app/build.gradle`:
200
+
201
+```groovy
202
+android {
203
+    ...
204
+}
205
+
206
+configurations.all {
207
+    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
208
+        def requested = details.requested
209
+        if (requested.group == 'com.android.support') {
210
+            details.useVersion "25.4.0" // <- Change this to whatever version you're using
211
+        }
212
+    }
213
+}
214
+
215
+dependencies {
216
+    ...
217
+    implementation 'com.android.support:design:25.4.0'
218
+    implementation 'com.android.support:appcompat-v7:25.4.0'
219
+}
220
+
221
+```