I am currently going through the React-Native tutorials. I began with the Getting Started tutorial, where I made a new react native project and successfully managed to run t
I figured out where the problem was in my case (Windows 10 OS), but It might also help in Linux as well( You might try).
In windows power shell
, when you want to run an app(first time after pc boot) by executing the following command,
react-native run-android
It starts a node process/JS server
in another console panel
, and you don't encounter this error. But, when you want to run another app, you must need to close that already running JS server console panel
. And then execute the same command for another app from the power shell
, that command will automatically start another new JS server for this app, and you won't encounter this error.
You don't need to close and reopen power shell
for running another app, you need to close node console
to run another app.
My issue was that in AndroidManifest.xml
and MainActivity.java
package names were different. So in manifest I had package=com.companyName.appName
and in activity package com.appName
In my case there's this line in MainActivity.java which was missed when I used react-native-rename
cli (from NPM)
protected String getMainComponentName() {
return "AwesomeApp";
}
Obviously ya gotta rename it to your app's name.
Non of the solutions worked for me. I had to kill the following process and re ran react-native run-android and it worked.
node ./local-cli/cli.js start
In my case i have got a different solution in case any one need
yarn remove react-native-material-dropdown
Install new packages react-native-material-dropdown-v2
yarn add react-native-material-dropdown-v2
Replace react-native-material-dropdown with react-native-material-dropdown-v2 in your code
e.g. import { Dropdown } from 'react-native-material-dropdown' to import { Dropdown } from 'react-native-material-dropdown-v2'
another thing ==========