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

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

问题描述

我试图通过使用expo android应用程序构建一个简单的react native应用程序,但是我总是收到这2条错误日志-Module AppRegistry不是已注册的可调用模块,并且无法找到变量:Constants.

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天全站免登陆