Hey, Guys here is the solution to the problem commonly faced by many of React Native developers nowadays that is the problem in ejecting the React Native Project after the React Native version 0.57 launch.
The problem in ejecting the React Native Project
The problem happens when we create a project using create-react-native-app
and try to eject the project using npm run eject
. It shows the error: cannot find symbol
and error: MainActivity is not abstract and does not override abstract method getPackages() in ReactActivity
Solution
To solve this problem we have you have to make some changes to your project and the changes are as following:
Step 1:
replace in package.json
"react-native": "https://github.com/expo/react-native/archive/sdk-30.0.0.tar.gz"
to
"react-native": "~0.55.2"
Step 2:
Make an index.js file in your project directory
Add the following code in index.js
import { AppRegistry } from "react-native";
import App from "./App";
AppRegistry.registerComponent( "projectname", () => App);
Step 3:
Now remove the node module folder and install again using
sudo npm install
Step 4:
That is enough to solve the problem now you can run your project again using
react-native run-android
If you have any doubts or you want to share something about the topic you can comment below or contact us here. There will be more posts coming soon. Stay tuned!
Hope you liked it. 🙂