Browse Source

reorder installation instructions (#4932)

jonathanmos 5 years ago
parent
commit
b444ab3092
1 changed files with 70 additions and 69 deletions
  1. 70
    69
      docs/docs/Installing.md

+ 70
- 69
docs/docs/Installing.md View File

@@ -159,7 +159,75 @@ dependencies {
159 159
 }
160 160
 ```
161 161
 
162
-### 5. Update `MainActivity.java`
162
+### 5 RNN and React Native version
163
+
164
+react-native-navigation supports multiple React Native versions. Target the React Native version required by your project by specifying the RNN build flavor in `android/app/build.gradle`.
165
+
166
+```diff
167
+android {
168
+    ...
169
+    defaultConfig {
170
+        applicationId "com.yourproject"
171
+        minSdkVersion rootProject.ext.minSdkVersion
172
+        targetSdkVersion rootProject.ext.targetSdkVersion
173
++        missingDimensionStrategy "RNN.reactNativeVersion", "reactNative57" // See note below!
174
+        versionCode 1
175
+        versionName "1.0"
176
+        ...
177
+    }
178
+    ...
179
+}
180
+```
181
+
182
+!>Important note about `missingDimensionStrategy`<Br>
183
+>`reactNative51` - RN 0.54.x and below<Br>
184
+>`reactNative55` - RN 0.55.x<Br>
185
+>`reactNative56` - RN 0.56.x<Br>
186
+>`reactNative57` - RN 0.57.0 - 0.57.4<Br>
187
+>`reactNative57_5` - RN 0.57.5 and above<Br>
188
+
189
+Now we need to instruct gradle how to build that flavor. To do so here two solutions:
190
+
191
+#### 5.1 Build app with gradle command 
192
+
193
+**prefered solution** The RNN flavor you would like to build is specified in `app/build.gradle`. Therefore in order to compile only that flavor, instead of building your entire project using `./gradlew assembleDebug`, you should instruct gradle to build the app module: `./gradlew app:assembleDebug`. The easiest way is to add a package.json command to build and install your debug Android APK .
194
+
195
+```
196
+"scripts": {
197
+  ...
198
+  "android": "cd ./android && ./gradlew app:assembleDebug && ./gradlew installDebug"
199
+}
200
+```
201
+
202
+Now run `npm run android` to build your application
203
+
204
+#### 5.2 Ignore other RNN flavors
205
+
206
+If you don't want to run `npm run android` and want to keep the default `react-native run-android` command, you need to specify to graddle to ignore the other flavors RNN provides.
207
+
208
+To do so edit `android/build.gradle` and add:
209
+
210
+```diff
211
++subprojects { subproject ->
212
++    afterEvaluate {
213
++        if ((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) {
214
++            android {
215
++                variantFilter { variant ->
216
++                    def names = variant.flavors*.name
217
++                    if (names.contains("reactNative51") || names.contains("reactNative55")) {
218
++                        setIgnore(true)
219
++                    }
220
++                }
221
++            }
222
++        }
223
++    }
224
++}
225
+```
226
+
227
+**Note**: As more build variants come available in the future, you will need to adjust the list (`names.contains("reactNative51") || names.contains("reactNative55")`). This is why we recommend the first solution.
228
+
229
+
230
+### 6. Update `MainActivity.java`
163 231
 
164 232
 `MainActivity.java` should extend `com.reactnativenavigation.NavigationActivity` instead of `ReactActivity`.
165 233
 
@@ -180,7 +248,7 @@ This file is located in `android/app/src/main/java/com/<yourproject>/MainActivit
180 248
 
181 249
 If you have any **react-native** related methods, you can safely delete them.
182 250
 
183
-### 6. Update `MainApplication.java`
251
+### 7. Update `MainApplication.java`
184 252
 
185 253
 This file is located in `android/app/src/main/java/com/<yourproject>/MainApplication.java`.
186 254
 	
@@ -237,73 +305,6 @@ import java.util.List;
237 305
 
238 306
 ```
239 307
 
240
-### 7 RNN and React Native version
241
-
242
-react-native-navigation supports multiple React Native versions. Target the React Native version required by your project by specifying the RNN build flavor in `android/app/build.gradle`.
243
-
244
-```diff
245
-android {
246
-    ...
247
-    defaultConfig {
248
-        applicationId "com.yourproject"
249
-        minSdkVersion rootProject.ext.minSdkVersion
250
-        targetSdkVersion rootProject.ext.targetSdkVersion
251
-+        missingDimensionStrategy "RNN.reactNativeVersion", "reactNative57" // See note below!
252
-        versionCode 1
253
-        versionName "1.0"
254
-        ...
255
-    }
256
-    ...
257
-}
258
-```
259
-
260
-!>Important note about `missingDimensionStrategy`<Br>
261
->`reactNative51` - RN 0.54.x and below<Br>
262
->`reactNative55` - RN 0.55.x<Br>
263
->`reactNative56` - RN 0.56.x<Br>
264
->`reactNative57` - RN 0.57.0 - 0.57.4<Br>
265
->`reactNative57_5` - RN 0.57.5 and above<Br>
266
-
267
-Now we need to instruct gradle how to build that flavor. To do so here two solutions:
268
-
269
-#### 7.1 Build app with gradle command 
270
-
271
-**prefered solution** The RNN flavor you would like to build is specified in `app/build.gradle`. Therefore in order to compile only that flavor, instead of building your entire project using `./gradlew assembleDebug`, you should instruct gradle to build the app module: `./gradlew app:assembleDebug`. The easiest way is to add a package.json command to build and install your debug Android APK .
272
-
273
-```
274
-"scripts": {
275
-  ...
276
-  "android": "cd ./android && ./gradlew app:assembleDebug && ./gradlew installDebug"
277
-}
278
-```
279
-
280
-Now run `npm run android` to build your application
281
-
282
-#### 7.2 Ignore other RNN flavors
283
-
284
-If you don't want to run `npm run android` and want to keep the default `react-native run-android` command, you need to specify to graddle to ignore the other flavors RNN provides.
285
-
286
-To do so edit `android/build.gradle` and add:
287
-
288
-```diff
289
-+subprojects { subproject ->
290
-+    afterEvaluate {
291
-+        if ((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) {
292
-+            android {
293
-+                variantFilter { variant ->
294
-+                    def names = variant.flavors*.name
295
-+                    if (names.contains("reactNative51") || names.contains("reactNative55")) {
296
-+                        setIgnore(true)
297
-+                    }
298
-+                }
299
-+            }
300
-+        }
301
-+    }
302
-+}
303
-```
304
-
305
-**Note**: As more build variants come available in the future, you will need to adjust the list (`names.contains("reactNative51") || names.contains("reactNative55")`). This is why we recommend the first solution.
306
-
307 308
 ### 8. Force the same support library version across all dependencies (optional)
308 309
 
309 310
 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: