Application XXX(項目名)&nbs…

Application XXX(項目名) has not beenRegistered. This  is either due to a require() error during initialization or failure to call AppRegistry.registerComponent

造成這種錯誤有兩種情況
1 。AppRegistry.registerComponent('項目名', () => 項目名); 與./ios/項目名/appDelegate.m中的RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation moduleName:@"項目名" initialProperties:nil launchOptions:launchOptions]; 不同
  在Android項目中可能是./android/app/src/main/java/com/項目名/MainActivity.java中的mReactRootView.startReactApplication(mReactInstanceManager, "項目名", null); 沒有保持一致,修改方法:編輯成相同的參數即可。

2.有可能你同時在運行一個以上的程序,像我。如果你的react-native在運行程序A而你打開了程序B,也會出現相同的問題。解決方法:關閉另一個程序
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章