Following the instructions for migrating from RN 0.59.10 to RN 0.60.6, I am getting the following error related to the use of the dependency react-native-navigation
(https://wix.github.io/react-native-navigation) when doing a react-native run-android
.
I have upgraded everything following this document:
https://reactnative.thenativebits.com/courses/upgrading-react-native/upgrade-to-react-native-0.60/
In package.json
I have changed the version of react-native-navigation
from "1.1.483" to "^3.2.0". I actually installed the new version via yarn add react-native-navigation@^3.2.0
. I have already gradlew clean
'ed and npm install
'ed the project many times while trying to make this work.
My app works fine with RN 0.59.10. I know RN 0.60.x is a "major" upgrade.
The log gives me the following errors:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 27s
error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
/Users/a/Workspaces/my-app/android/app/src/main/java/a/b/c/MainApplication.java:24: error: package com.reactnativenavigation does not exist
import com.reactnativenavigation.NavigationApplication;
^
/Users/a/Workspaces/my-app/android/app/src/main/java/a/b/c/MainApplication.java:25: error: package com.reactnativenavigation.controllers does not exist
import com.reactnativenavigation.controllers.ActivityCallbacks;
^
/Users/a/Workspaces/my-app/android/app/src/main/java/a/b/c/MainApplication.java:42: error: cannot find symbol
public class MainApplication extends NavigationApplication {
^
symbol: class NavigationApplication
Etc ..
I know the main problem is that MainApplication.java
wants to import the package com.reactnativenavigation
and it does not exist. I went inside node_modules/
and checked that inside react-native-navigation/
there are no sources. With the version 1.1.483
there where sources (I know it is a really old version, but I have inherited this project), and that Java package was found. Still, with that version, PackageList.java
would break like this:
/Users/a/Workspaces/my-app/android/app/build/generated/rncli/src/main/java/com/facebook/react/PackageList.java:27: error: cannot find symbol
import com.reactnativenavigation.NavigationReactPackage;
^
symbol: class NavigationReactPackage
location: package com.reactnativenavigation
Because it does not find the class NavigationReactPackage
under com.reactnativenavigation
, and checking the sources, I see that this class
is in the package com.reactnativenavigation.bridge.
(Why does it look for it in the wrong package? I know RN 60 is auto linked now? But I don't care if I could just upgrade my navigation dependency to over 3.x.x where they Support RN 0.60)
What am I missing here? Any help is welcome.
Right now this is my package.json
{
"name": "a",
"version": "1.0.0",
"private": true,
"scripts": {
"start": "react-native start",
"android:dev": "react-native run-android",
"android:release": "ENV=production ./scripts/enviroment.sh && cd android && ./gradlew assembleRelease",
"ios:dev": "react-native run-ios",
"postinstall": "cd ios && rm -rf a.xcworkspace && pod install && cd ..",
"test": "jest",
"lint": "eslint .",
"android-dev": "ENV=development ./scripts/enviroment.sh && react-native run-android",
"android-prod": "ENV=production ./scripts/enviroment.sh && react-native run-android",
"ios-dev": "ENV=development ./scripts/enviroment.sh && react-native run-ios",
"ios-prod": "ENV=production ./scripts/enviroment.sh && react-native run-ios"
},
"dependencies": {
"lodash": "4.17.10",
"moment": "2.22.2",
"prop-types": "^15.6.2",
"react": "16.8.6",
"react-native": "0.60.6",
"react-native-actionsheet": "^2.4.2",
"react-native-admob": "^2.0.0-beta.5",
"react-native-catch-first-time": "^0.0.1",
"react-native-device-info": "0.22.5",
"react-native-facebook-login": "^1.6.1",
"react-native-firebase": "4.3.8",
"react-native-google-signin": "1.0.0-rc3",
"react-native-material-kit": "^0.5.1",
"react-native-navigation": "^3.2.0",
"react-native-network-info": "3.2.2",
"react-native-rate": "1.1.2",
"react-native-snackbar": "0.5.0",
"react-native-store-review": "^0.1.5",
"react-native-twitter-signin": "1.1.1",
"react-redux": "5.0.7",
"redux": "^4.0.0",
"redux-logger": "^3.0.6",
"redux-thunk": "^2.3.0"
},
"devDependencies": {
"@babel/core": "^7.6.2",
"@babel/runtime": "^7.6.2",
"@react-native-community/eslint-config": "^0.0.5",
"babel-eslint": "^8.2.6",
"babel-jest": "^24.9.0",
"babel-plugin-module-resolver": "^3.1.1",
"babel-plugin-transform-remove-console": "^6.9.4",
"eslint": "^6.4.0",
"eslint-config-airbnb": "17.1.0",
"eslint-config-prettier": "3.0.1",
"eslint-import-resolver-babel-module": "^4.0.0",
"eslint-plugin-import": "2.14.0",
"eslint-plugin-jsx-a11y": "^6.1.1",
"eslint-plugin-prettier": "^2.6.2",
"eslint-plugin-react": "7.11.1",
"eslint-plugin-react-native": "^3.2.1",
"jest": "^24.9.0",
"metro-react-native-babel-preset": "^0.56.0",
"prettier": "1.14.2",
"react-test-renderer": "16.8.6"
},
"jest": {
"preset": "react-native"
}
}