15

I have recently started to convert my react native app and running on Expo so i could test this on my actual android device. I am getting this error above. I have since then running my app using the Expo XDE. I am also running on a windows machine.

The full error message is:

enter image description here]1

I figured that this has something to do with my index.js, yet here it is

import { AppRegistry } from 'react-native';
import App from './App';

AppRegistry.registerComponent('projectTARA', () => 'App');
johnobc
  • 571
  • 3
  • 11
  • 25

6 Answers6

23

The following solution worked:

AppRegistry.registerComponent('main',() => App);

Credits: Rishav Kumar

(Cannot you people just reply to mark as solve ?)

ATX
  • 1,139
  • 2
  • 11
  • 29
  • Well though this may help, the reason depends on how is "index.android" or "index.ios" in native code. For example in android case last answer here could help https://stackoverflow.com/questions/38340360/react-native-application-has-not-been-registered-error/57336321#57336321 – Carmine Tambascia Aug 03 '19 at 08:51
  • 2
    Is this supposed to be typed at the command prompt or placed in a file? – kojow7 Aug 14 '19 at 07:25
2

The problem is you haven't opened your project in Android Studio. The previous project is running in android studio and you are running the latest one in emulator.

2

I created a Project from "Doco", and save it with Practice. so write that line like that

AppRegistry.registerComponent('Practice', () => FixedDimensionsBasics);

then I get an error like in a question

So, I check on my Appdelegate.m file on ios folder and find that Project name is Project so I change that line with

AppRegistry.registerComponent('Project', () => FixedDimensionsBasics);

and my Error solved

so if you are using "Doco" then check that thing.

Suraj Rao
  • 29,388
  • 11
  • 94
  • 103
raavan199
  • 125
  • 1
  • 1
  • 10
1

I came across this issue because I had previously run a React project that was not fully shut down. To fix this, I could have restarted my computer. But I chose to do this instead: (Using MacOS, should work with Linux as well, for Windows you would likely need to use Task Manager or similar):

  1. Open terminal
  2. Find the program that is using port 8081 by typing "lsof -i :8081". (Note this is LSOF in lowercase)
  3. Look at the process ID (under the PID column)
  4. Kill the process by typing "kill -9 PID" (where PID is the process ID number you found in step 3).

After killing the process you should be able to run your react-native project.

kojow7
  • 10,308
  • 17
  • 80
  • 135
1

Removed node_modules and reinstalled by yarn that worked for me.

tiennv
  • 356
  • 5
  • 13
  • 3
    this happened to me because I globally updated expo but the project was generated with an older version, so your solution did the trick – Daniel Arechiga Sep 06 '20 at 06:51
0

Error ? if you are running your app on the expo framework, the framework cannot find registration of the main App,or its entry point.

Solution ? go to you entry script, could be "src/main.js" or in my case the "App.js" then;

import { registerRootComponent } from 'expo';

export default function App(){
    //your code app code goes here
}

registerRootComponent(App);

Refer here: https://docs.expo.dev/versions/latest/sdk/register-root-component/

bitbuoy
  • 353
  • 2
  • 8