应用项目尚未注册

Sih*_*ine 6 react-native

我正在尝试在我的设备上运行我的react本机应用程序.所以我运行react-native start 一切看起来很好. 在此输入图像描述

并且在运行时react-native run-android我收到此错误 在此输入图像描述

否则,我的设备出现此错误

在此输入图像描述

Har*_*eno 5

我的问题是我给该项目的名称与AppRegistry中注册的名称不同

AppRegistry.registerComponent('proj', () => proj)
Run Code Online (Sandbox Code Playgroud)

proj 需要与gradle和config文件中的项目名称相同.


Wol*_*ine 1

您需要导出该类。使用下面的代码

 import React, { Component } from 'react' 
import { AppRegistry, Text, View } from 'react-native'
export default class proj extends Component {
 render() { 
return ( 
<View style={styles.container}> <Text > Welcome to PutainDeBiere! </Text> </View> ) 
} 
}
 AppRegistry.registerComponent('proj', () => proj)
Run Code Online (Sandbox Code Playgroud)