Invariant Violation: com.appName has not been registered. This can happen if: – React Native Error. How to fix?
I refactored my android app’s package name that I’d been developing using react native and I ran into this error.
Advertisements
Invariant Violation: "com.appName" has not been registered. This can happen if: │ * Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project. └ * A module failed to load due to an error and `AppRegistry.registerComponent` wasn't called.
This happened because I forgot to change the App Name in the app.json which was used by AppRegistry registration.
import {AppRegistry} from 'react-native'; import App from './App'; import {name as appName} from './app.json'; AppRegistry.registerComponent(appName, () => App);
Advertisements
Hence, I had to fix app.json.
{ "name": "com.appName", "displayName": "NewAppName" }