React-Native: application not registered

I am currently going through React-Native tutorials. I started with the Getting Started tutorial in which I created my own new response project and was able to successfully launch the project on my device.

Then I ran the Props tutorial , copied the code snippet and tried to run the project again, and the following error message appeared on my screen:

+148
javascript facebook reactjs react-native
Jul 12 '16 at 23:25
source share
19 answers

I assume this is an error caused by a mismatch between the project name and the registered component.

You have included a project with the same name, i.e.

react-native init AwesomeApp

But in your index.ios.js file you are registering another component

AppRegistry.registerComponent('Bananas', () => Bananas);

When should it be

AppRegistry.registerComponent('AwesomeApp', () => Bananas);

Try to fix it.

+396
Jul 13 '16 at 6:12
source share

In most cases, the problem is that you have another react-native start server (for example, React Native Packager) running either on a different terminal or on a different TMUX tab (if you use TMUX).

You need to find this process and close it, so, for example, after running react-native run-ios it will install a new packer server registered for this particular application.

Just find this process using:

 ps aux | grep react-native 

find the process identifier (PID) and kill the packer process using the kill command (for example, kill -9 [PID] ). You should find the launchPackager.command application on macOS, not sure about other operating systems.

Then try running run-ios (or android) again. You should see a new path after starting a new packer server, for example:

 Looking for JS files in /Users/afshin/Desktop/awesome-app 
+39
Jan 10 '17 at 10:24 on
source share

Modify MainActivity as follows:

 @Override protected String getMainComponentName() { return "Bananas"; // here } 
+30
Jan 23 '17 at 10:29 on
source share

My solution is to change the module name in "AppDelegate.m"

from moduleName:@"AwesomeProject"

to moduleName:@"YourNewProjectName"

+20
Sep 10 '18 at 7:44
source share

First of all, you should run your application:

 react-native start 

Then you should set your application name as the first argument to registerComponent.

It works great.

 AppRegistry.registerComponent('YourProjectName', () => YourComponentName); 
+15
Apr 01 '17 at 15:47 on
source share

Please check your app.json file in the project. if there is no appKey line then you must add it

 { "expo": { "sdkVersion": "27.0.0", "appKey": "mydojo" }, "name": "mydojo", "displayName": "mydojo" } 
+6
Aug 25 '18 at 5:55
source share

In my case, there is this line in MainActivity.java that was skipped when I used response react-native-rename cli (from NPM)

 protected String getMainComponentName() { return "AwesomeApp"; } 

Obviously, you should rename it to the name of your application.

+5
Feb 21 '18 at 2:25
source share

I had the same problem, and for me the main reason was that I was launching (responding to my own launch) the packer from another user-related folder (AwesomeApp), while I created another project in a different folder.

Running the package from a new application directory enabled it.

+3
Dec 23 '16 at 10:25
source share

I think the host server is running from a different folder. So kill him and run in the current folder.

Find a working server node: -

lsof -i :8081

Kill a running server node: -

kill -9 <PID>

For example:-

kill -9 1653

Start the host server from the current native source folder: -

react-native run-android

+3
Aug 09 '18 at 6:25
source share

you need to register it in index.android.js / index.ios.js

like this:

 'use strict'; import { AppRegistry } from 'react-native'; import app from "./app"; AppRegistry.registerComponent('test', () => app); 
+1
Jun 30 '17 at 5:30
source share

This may also be due to the fact that the name of the root component begins with a lowercase.

Restore it, or rather create a project again with the name PascalCase.

eg. light new HelloWord

+1
Nov 15 '17 at 16:15
source share

All the above answers did not help me.

I had another node process running in another terminal, I closed this command terminal, and everything worked as expected.

+1
May 23 '18 at 5:11
source share

This problem will also appear when you didn’t name the application in index.js the way you named it for the android / ios package ; perhaps this happened when you threw the application away. Therefore, make sure that when calling AppRegistry.registerComponent('someappname',() => App) someappname is also used for native packages or vice versa.

+1
Aug 05 '18 at 9:50
source share

Instead of changing the name in AppRegistry ,

Run action-native init Bananas, this will create reactive boilerplate code for the Bananas project, and AppRegistry.registerComponent will automatically point to bananas

 AppRegistry.registerComponent('Bananas', () => Bananas); 
0
Nov 17 '16 at 4:05
source share

None of the solutions worked for me. I had to kill the next process and restart the reaction native Android launch, and it worked.

start of node. /local-cli/cli.js

0
May 31 '18 at 22:33
source share

I have the same problem. I used Windows to create my own Android application and I had the same error. Here is what worked.

  • Browse to the ANDROID folder in your root.
  • Create a file named: local.properties
  • Open it in the editor and write:

sdk.dir = C: \ Users \ USERNAME \ AppData \ Local \ Android \ sdk

  • Replace USERNAME with your machine name.

Save and run the application as usual. It worked for me.

0
Jul 13 '18 at 19:40
source share

I figured out where the problem is in my case (Windows 10), but it may also help on Linux (you can try).

In windows power shell , when you want to run the application (the first time after loading the PC) by running the following command,

 react-native run-android 

It starts the node process/JS server on another console panel , and you will not encounter this error. But, when you want to start another application, you must close it , that the JS server console panel already working. And then run the same command for another application from the power shell , this command will automatically start another new JS server for this application, and you will not encounter this error.

You do not need to close and reopen the power shell to start another application, you need to close the node console to start another application.

0
Oct 17 '18 at 4:29
source share

For me, none of the answers worked.

0
Jan 27 '19 at 11:33
source share

After reading all of the above, I found that there could be another reason for this.

In my case:

response-native-cli: 2.0.1

reactive: 0.60.4

and the following structure:

enter image description here

First of all, it should be noted that index.android was not updated in Android Studio during the assembly performed by the Metro-linker (response-native run-android), so this must be done manually. Also in Android Studio do not "read"

app.json (created by default along with index.js, which is renamed index.android.js):

  { "name": "authApp", "displayName": "authApp" } 

and so this is how

(in my case)

 import {authApp as appName} from './app.json'; 

the reason is that android studio does not know what authApp refers to. I am fixing it at the moment, referring to the application name with its string name and not using this import from app.json:

 AppRegistry.registerComponent('authApp', () => MyApp); 
0
Aug 03 '19 at 7:24
source share



All Articles