不变违规:“myApp”尚未注册

时间:2021-01-15 10:10:26

标签: react-native-android

已经搜索过了,我不知道出了什么问题。 应用未注册错误不断出现。

索引文件

/**
 * @format
 */

import {AppRegistry} from 'react-native';
import App from './App';
import {name as appName} from './app.json';

AppRegistry.registerComponent(appName, () => App);

app.json 文件

{
  "name": "election_watch",
  "displayName": "election_watch"
}

MainActivity.java 文件

公共类 MainActivity 扩展了 ReactActivity {

  /**
   * Returns the name of the main component registered from JavaScript. This is used to schedule
   * rendering of the component.
   */
  @Override
  protected String getMainComponentName() {
    return "election_watch";
  }
}

请帮忙解决我的代码有什么问题。

0 个答案:

没有答案