|
@@ -49,71 +49,71 @@
|
49
|
49
|
|
50
|
50
|
### 1. Add the following in `android/settings.gradle`:
|
51
|
51
|
|
52
|
|
- ```groovy
|
53
|
|
- include ':react-native-navigation'
|
54
|
|
- project(':react-native-navigation').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-navigation/lib/android/app/')
|
55
|
|
- ```
|
|
52
|
+```groovy
|
|
53
|
+include ':react-native-navigation'
|
|
54
|
+project(':react-native-navigation').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-navigation/lib/android/app/')
|
|
55
|
+```
|
56
|
56
|
|
57
|
57
|
### 2. Update `android/build.gradle`:
|
58
|
58
|
|
59
|
|
- ```diff
|
60
|
|
- buildscript {
|
61
|
|
- repositories {
|
62
|
|
- + google()
|
63
|
|
- + mavenLocal()
|
64
|
|
- + mavenCentral()
|
65
|
|
- + jcenter()
|
66
|
|
- }
|
67
|
|
- dependencies {
|
68
|
|
- + classpath 'com.android.tools.build:gradle:3.0.1'
|
69
|
|
- - classpath 'com.android.tools.build:gradle:2.2.3'
|
70
|
|
- }
|
|
59
|
+```diff
|
|
60
|
+buildscript {
|
|
61
|
+ repositories {
|
|
62
|
++ google()
|
|
63
|
++ mavenLocal()
|
|
64
|
++ mavenCentral()
|
|
65
|
++ jcenter()
|
71
|
66
|
}
|
72
|
|
-
|
73
|
|
- allprojects {
|
74
|
|
- repositories {
|
75
|
|
- + google()
|
76
|
|
- + mavenCentral()
|
77
|
|
- + mavenLocal()
|
78
|
|
- jcenter()
|
79
|
|
- maven {
|
80
|
|
- // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
|
81
|
|
- url "$rootDir/../node_modules/react-native/android"
|
82
|
|
- }
|
83
|
|
- + maven { url 'https://jitpack.io' }
|
|
67
|
+ dependencies {
|
|
68
|
++ classpath 'com.android.tools.build:gradle:3.0.1'
|
|
69
|
+- classpath 'com.android.tools.build:gradle:2.2.3'
|
|
70
|
+ }
|
|
71
|
+}
|
|
72
|
+
|
|
73
|
+allprojects {
|
|
74
|
+ repositories {
|
|
75
|
++ google()
|
|
76
|
++ mavenCentral()
|
|
77
|
++ mavenLocal()
|
|
78
|
+ jcenter()
|
|
79
|
+ maven {
|
|
80
|
+ // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
|
|
81
|
+ url "$rootDir/../node_modules/react-native/android"
|
84
|
82
|
}
|
|
83
|
++ maven { url 'https://jitpack.io' }
|
85
|
84
|
}
|
86
|
|
- ```
|
|
85
|
+}
|
|
86
|
+```
|
87
|
87
|
|
88
|
88
|
### 3. Update project dependencies in `android/app/build.gradle`.
|
89
|
89
|
|
90
|
|
- ```groovy
|
91
|
|
- android {
|
92
|
|
- compileSdkVersion 25
|
93
|
|
- buildToolsVersion "27.0.3"
|
94
|
|
-
|
95
|
|
- defaultConfig {
|
96
|
|
- minSdkVersion 19
|
97
|
|
- targetSdkVersion 25
|
98
|
|
- missingDimensionStrategy "RNN.reactNativeVersion", "reactNative51" // <- See note below for further instruction regarding compatibility with other React Native versions
|
99
|
|
- ...
|
100
|
|
- }
|
|
90
|
+```groovy
|
|
91
|
+android {
|
|
92
|
+ compileSdkVersion 25
|
|
93
|
+ buildToolsVersion "27.0.3"
|
101
|
94
|
|
102
|
|
- compileOptions {
|
103
|
|
- sourceCompatibility JavaVersion.VERSION_1_8
|
104
|
|
- targetCompatibility JavaVersion.VERSION_1_8
|
105
|
|
- }
|
106
|
|
- ...
|
|
95
|
+ defaultConfig {
|
|
96
|
+ minSdkVersion 19
|
|
97
|
+ targetSdkVersion 25
|
|
98
|
+ missingDimensionStrategy "RNN.reactNativeVersion", "reactNative51" // <- See note below for further instruction regarding compatibility with other React Native versions
|
|
99
|
+ ...
|
107
|
100
|
}
|
108
|
|
-
|
109
|
|
- dependencies {
|
110
|
|
- implementation fileTree(dir: "libs", include: ["*.jar"])
|
111
|
|
- implementation "com.android.support:appcompat-v7:25.4.0"
|
112
|
|
- implementation "com.facebook.react:react-native:+"
|
113
|
|
- implementation project(':react-native-navigation')
|
|
101
|
+
|
|
102
|
+ compileOptions {
|
|
103
|
+ sourceCompatibility JavaVersion.VERSION_1_8
|
|
104
|
+ targetCompatibility JavaVersion.VERSION_1_8
|
114
|
105
|
}
|
115
|
|
- ```
|
116
|
|
- > react-native-navigation supports multiple React Native versions. Target the React Native version required by your project by specifying the RNN build flavor you require.
|
|
106
|
+ ...
|
|
107
|
+}
|
|
108
|
+
|
|
109
|
+dependencies {
|
|
110
|
+ implementation fileTree(dir: "libs", include: ["*.jar"])
|
|
111
|
+ implementation "com.android.support:appcompat-v7:25.4.0"
|
|
112
|
+ implementation "com.facebook.react:react-native:+"
|
|
113
|
+ implementation project(':react-native-navigation')
|
|
114
|
+}
|
|
115
|
+```
|
|
116
|
+> react-native-navigation supports multiple React Native versions. Target the React Native version required by your project by specifying the RNN build flavor you require.
|
117
|
117
|
><br><br>Available options:
|
118
|
118
|
>
|
119
|
119
|
>* `reactNative51`: Support for React Native 0.51-0.54
|
|
@@ -126,65 +126,65 @@
|
126
|
126
|
|
127
|
127
|
### 4. Make sure you're using the new gradle plugin, edit `android/gradle/wrapper/gradle-wrapper.properties`
|
128
|
128
|
|
129
|
|
- ```diff
|
130
|
|
- distributionBase=GRADLE_USER_HOME
|
131
|
|
- distributionPath=wrapper/dists
|
132
|
|
- zipStoreBase=GRADLE_USER_HOME
|
133
|
|
- zipStorePath=wrapper/dists
|
134
|
|
- +distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
|
135
|
|
- -distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
|
136
|
|
- ```
|
|
129
|
+```diff
|
|
130
|
+distributionBase=GRADLE_USER_HOME
|
|
131
|
+distributionPath=wrapper/dists
|
|
132
|
+zipStoreBase=GRADLE_USER_HOME
|
|
133
|
+zipStorePath=wrapper/dists
|
|
134
|
++distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
|
|
135
|
+-distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
|
|
136
|
+```
|
137
|
137
|
|
138
|
138
|
### 5. Update `gradle.properties` and disable incremental resource processing
|
139
|
139
|
|
140
|
|
- ```diff
|
141
|
|
- +# Disable incremental resource processing as it broke relase build
|
142
|
|
- +android.enableAapt2=false
|
143
|
|
- ```
|
|
140
|
+```diff
|
|
141
|
++# Disable incremental resource processing as it broke relase build
|
|
142
|
++android.enableAapt2=false
|
|
143
|
+```
|
144
|
144
|
|
145
|
145
|
### 6. In `MainActivity.java` it should extend `com.reactnativenavigation.NavigationActivity` instead of `ReactActivity`.
|
146
|
146
|
|
147
|
|
- This file can be located in `android/app/src/main/java/com/yourproject/`.
|
|
147
|
+This file can be located in `android/app/src/main/java/com/yourproject/`.
|
148
|
148
|
|
149
|
|
- ```java
|
150
|
|
- import com.reactnativenavigation.NavigationActivity;
|
|
149
|
+```java
|
|
150
|
+import com.reactnativenavigation.NavigationActivity;
|
151
|
151
|
|
152
|
|
- public class MainActivity extends NavigationActivity {
|
|
152
|
+public class MainActivity extends NavigationActivity {
|
153
|
153
|
|
154
|
|
- }
|
155
|
|
- ```
|
|
154
|
+}
|
|
155
|
+```
|
156
|
156
|
|
157
|
|
- If you have any **react-native** related methods, you can safely delete them.
|
|
157
|
+If you have any **react-native** related methods, you can safely delete them.
|
158
|
158
|
|
159
|
159
|
### 7. In `MainApplication.java`, add the following
|
160
|
160
|
|
161
|
|
- ```java
|
162
|
|
- import com.reactnativenavigation.NavigationApplication;
|
|
161
|
+```java
|
|
162
|
+import com.reactnativenavigation.NavigationApplication;
|
163
|
163
|
|
164
|
|
- public class MainApplication extends NavigationApplication {
|
165
|
|
- @Override
|
166
|
|
- public boolean isDebug() {
|
167
|
|
- return BuildConfig.DEBUG;
|
168
|
|
- }
|
|
164
|
+public class MainApplication extends NavigationApplication {
|
|
165
|
+ @Override
|
|
166
|
+ public boolean isDebug() {
|
|
167
|
+ return BuildConfig.DEBUG;
|
|
168
|
+ }
|
169
|
169
|
|
170
|
|
- @Override
|
171
|
|
- public List<ReactPackage> createAdditionalReactPackages() {
|
172
|
|
- return Arrays.<ReactPackage>asList(
|
173
|
|
- // eg. new VectorIconsPackage()
|
174
|
|
- );
|
175
|
|
- }
|
176
|
|
- }
|
177
|
|
- ```
|
178
|
|
- Make sure that `isDebug` method is implemented.
|
|
170
|
+ @Override
|
|
171
|
+ public List<ReactPackage> createAdditionalReactPackages() {
|
|
172
|
+ return Arrays.<ReactPackage>asList(
|
|
173
|
+ // eg. new VectorIconsPackage()
|
|
174
|
+ );
|
|
175
|
+ }
|
|
176
|
+}
|
|
177
|
+```
|
|
178
|
+Make sure that `isDebug` method is implemented.
|
179
|
179
|
|
180
|
180
|
### 8. Update `AndroidManifest.xml` and set `application` **android:name** value to `.MainApplication`
|
181
|
181
|
|
182
|
|
- ```xml
|
183
|
|
- <application
|
184
|
|
- android:name=".MainApplication"
|
185
|
|
- ...
|
186
|
|
- />
|
187
|
|
- ```
|
|
182
|
+```xml
|
|
183
|
+<application
|
|
184
|
+ android:name=".MainApplication"
|
|
185
|
+ ...
|
|
186
|
+/>
|
|
187
|
+```
|
188
|
188
|
### 9. Force the same support library version across all dependencies
|
189
|
189
|
|
190
|
190
|
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:
|