模块 AppRegistry 不是已注册的可调用模块,并且无法找到变量:常量 [英] Module AppRegistry is not a registered callable module and Cant find variable: Constants

查看:7
本文介绍了模块 AppRegistry 不是已注册的可调用模块,并且无法找到变量:常量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 expo android 应用程序构建一个简单的反应本机应用程序,但我总是收到这 2 个错误日志 - 模块 AppRegistry 不是注册的可调用模块并且无法找到变量:常量.

I am trying to build a simple react native app by using expo android app but I am getting these 2 error log always - Module AppRegistry is not a registered callable module and Cant find variable: Constants.

import React, { Component } from "react";
import { StyleSheet, Text, View, Image } from "react-native";

export default class App extends Component {
  render() {
    return (

      <View style={{ flex: 1, justifyContent: "center", alignItems: "center" }}>
        <Text>Hello, world!</Text>
      </View>
    );
  }
}

我在笔记本电脑上使用移动热点.

I am using my mobile hotspot in my laptop.

推荐答案

我参考这个链接写了答案.

I wrote the answer by referring to this link.

这里

  1. cd android
  2. sudo ./gradlew clean
  3. 然后回到工作目录运行react-native run-android

你也应该在升级后重新启动你的 npm.

you should restart your npm too after that upgrade.

删除程序中的Constant用法.

delete the Constant usage in the program.

import android.provider.SyncStateContract.Constants.ConstantName

这将导致找不到常量错误消失.

This will cause the Can not find Constants error to disappear.

希望这能解决你的问题.

I hope this will solve your problem.

这篇关于模块 AppRegistry 不是已注册的可调用模块,并且无法找到变量:常量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆