我真的不知道是怎麼回事。 我已經建立了一個基本的應用程序,並使用代碼共享方法發現here。 這一切都非常基本的,所以這裏的代碼:陣營 - 原生Android:錯誤調用AppRegistry.runApplication
// index.android.js
// index.ios.js
import React, { AppRegistry } from 'react-native';
import CompetitionAgent from './app/index';
AppRegistry.registerComponent('CompetitionAgent',() => CompetitionAgent);
和組件:
//./app/index.js
import React, { Component } from 'react';
import {
StyleSheet,
Text,
TextInput,
View
} from 'react-native';
export default class CompetitionAgent extends Component {
constructor() {
super();
this.state = {nickname:''};
}
render() {
return (
<View style={styles.container}>
<View style={styles.information}>
<Text style={styles.welcome}>
Welcome to the Competition Agent Connect app!
</Text>
<Text style={styles.instructions}>
When you are near a Competition Agent, you can join the session.
</Text>
</View>
<View style={{padding:10}}>
<TextInput style={styles.inputStyle} />
</View>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
},
information: {
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
inputStyle: {
flexDirection: 'row',
backgroundColor: '#3E3134',
color: '#FFFFFF',
}
});
我知道錯誤可能是很多事情。所以這個基本的佈局會產生相同的錯誤。
import React, { Component } from 'react';
import {
StyleSheet,
Text,
TextInput,
View
} from 'react-native';
export default class CompetitionAgent extends Component {
constructor() {
super();
this.state = {nickname:''};
}
render() {
return (
<View style={styles.container}>
<Text style={styles.information}>
Welcome to the Competition Agent Connect app!
</Text>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
},
information: {
alignItems: 'center',
backgroundColor: '#F5FCFF',
}
});
堆棧跟蹤:
E/unknown:React: Exception in native call
java.lang.RuntimeException: Error calling AppRegistry.runApplication
at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31)
at android.os.Looper.loop(Looper.java:158)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:208)
at java.lang.Thread.run(Thread.java:818)
Caused by: com.facebook.jni.CppException: Could not get BatchedBridge, make sure your bundle is packaged correctly
at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31)
at android.os.Looper.loop(Looper.java:158)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:208)
at java.lang.Thread.run(Thread.java:818)
昨天就好跑,重新啓動Android的工作室都於事無補。
我會試試看。我的Mac從昨天開始就處於待機狀態,並且一切正常,工作正常......我不太熟悉Mac或打包者。猜猜我有幾件事要弄清楚。 – DerpyNerd
看看是否適合你。反應包裝商偶爾會自行死亡,因此必須重新啓動。 – YSK
經驗教訓和指出。開始打包並設置端口轉發並重新運行...謝謝 – DerpyNerd