Application main has not been registered

守給你的承諾、 提交于 2019-12-19 14:03:13

问题


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:

]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');

回答1:


The following solution worked:

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

Credits: Rishav Kumar

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




回答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.




回答3:


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.




回答4:


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.



来源:https://stackoverflow.com/questions/49410115/application-main-has-not-been-registered

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!