React-Native: Module AppRegistry is not a registered callable module

I'm currently trying to get the ES6 react-native-webpack-server running on an Android emulator. The difference is I've upgraded my package.json and build.grade to use react 0.18.0, and am getting this error on boot. As far as I'm aware AppRegistry is imported correctly. Even if I were to comment out the code this error still comes up. This does work on iOS without issue.

What am I doing wrong?

EDIT: After trying other boilerplates that do support 0.18.0, I'm still coming across the same issue.

enter image description here


Solution 1:

i just upgraded to react-native 0.18.1 today tough having some peer dependencies issues with 0.19.0-rc pre-release version.

Back to your question, what I did was

  1. cd android
  2. sudo ./gradlew clean (more information about how clean works here)

then back to the working directory and run react-native run-android

you should restart your npm too after that upgrade.

hope this works for you.

Solution 2:

I had the same issue on iOS and the cause for me was that my index.ios.js was incorrect (because I copy-pasted one of the examples without looking at its contents), it was ending with a module export declaration

exports.title = ...
exports.description = ...
module.exports = MyRootComponent;

Instead of the expected

AppRegistry.registerComponent('MyAppName', () => MyRootComponent);

You could have the same issue on android with the index.android.js I guess.