Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React Native 0.58.X not running on Android Simulator nor Android Device #23349

Closed
matthewfbenjamin opened this issue Feb 8, 2019 · 8 comments
Labels
Bug Platform: Android Android applications. Resolution: Locked This issue was locked by the bot.

Comments

@matthewfbenjamin
Copy link

matthewfbenjamin commented Feb 8, 2019

🐛 Bug Report

Hi! I have been banging my head against a wall for a while now with this one. As the title mentions, I am using React-Native 0.58.3 and when I try to run on any Android Simulator (regardless if I've installed the app on it before or not) I get a familiar error:

React native version mismatch.
JavaScript version: 0.56.1
Native versions: 0.58.3

So I tried everything the internet said to do...and more: blow out my node_modules, reset my watchman cache, confirm my build.gradle is forcing the react-native version, etc. I then started to clear the emulator cache, delete the emulator and create a new one, try it on another developer's machine, but to no avail.

Update: I now ran into this issue on a physical device (Samsung Galaxy S7, Version 6.0.1).

To Reproduce

Run react-native version 0.58.3 on an android simulator. Make sure you remove node modules and then reinstall them and restart your metro bundler.

Expected Behavior

The code works.

Environment

React Native Environment Info:
    System:
      OS: macOS 10.14.2
      CPU: (12) x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
      Memory: 64.63 MB / 16.00 GB
      Shell: 5.3 - /bin/zsh
    Binaries:
      Node: 8.12.0 - ~/.nvm/versions/node/v8.12.0/bin/node
      Yarn: 1.12.3 - /usr/local/bin/yarn
      npm: 6.4.1 - ~/.nvm/versions/node/v8.12.0/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
      Android SDK:
        API Levels: 23, 24, 25, 26, 27, 28
        Build Tools: 23.0.1, 26.0.3, 27.0.3, 28.0.3
        System Images: android-23 | Google APIs Intel x86 Atom, android-24 | Google APIs Intel x86 Atom, android-27 | Google Play Intel x86 Atom, android-28 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom
    IDEs:
      Android Studio: 3.2 AI-181.5540.7.32.5056338
      Xcode: 10.1/10B61 - /usr/bin/xcodebuild
    npmPackages:
      react: 16.6.3 => 16.6.3
      react-native: 0.58.3 => 0.58.3
    npmGlobalPackages:
      react-native-git-upgrade: 0.2.7
      react-native-log-ios: 1.0.0

image

@dapx
Copy link

dapx commented Feb 8, 2019

Same problem with 0.54.8, It's not loading the bundle from metro, It's loading from android/app/src/main/res/.
The version mismatch is because the android/app/src/main/res/*bundle.js* is old and not updated.

You could try react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res/

But I think that It should be resolved.
It has happened on Linux, on OSX it's working.

@matthewfbenjamin
Copy link
Author

matthewfbenjamin commented Feb 8, 2019

I'm using OSX and facing it too but thanks for the recommendation! I'll give it a try now.

Update: Bundled the app with the above command (thanks to @dap1995) and was able to run on the simulator, but it doesn't solve the issue of being able to "communicate" with the metro bundler.

@react-native-bot react-native-bot added the Platform: Android Android applications. label Feb 8, 2019
@matthewfbenjamin matthewfbenjamin changed the title React Native 0.58.X not running on Android Simulator React Native 0.58.X not running on Android Simulator nor Android Device Feb 8, 2019
@dulmandakh
Copy link
Contributor

could you please check react-native version in package.json, and run yarn install.

@dapx
Copy link

dapx commented Feb 10, 2019

I think that the problem is caused by a bug on react-native , cause the version mismatch is due an outdated bundle in android/app/src/main/res/. When running on android emulator, It doesn't make a request to metro bundler.

@OlivierFreyssinet-old
Copy link

OlivierFreyssinet-old commented Feb 11, 2019

I think that the problem of being unable to connect to the packager is related to this PR:
#23135

I managed to fix the "could not connect to development server" problem by applying these changes:
matt-oakes@fcd87ea#diff-000345b547ae9a4ea63fc5705b33fdca

@matthewfbenjamin
Copy link
Author

matthewfbenjamin commented Feb 11, 2019

So I added the network_security_config file and the lines to the AndroidManifest and so far it seems to work! I will re-open if I run into this issue again!

@andresmtz98
Copy link

Hey guys, help me please. How do i remove safely the index.android.bundle to run from Metro Bundler? If i delete the ...bundle then RN shows 'index.android.bundle' error :(

@matthewfbenjamin
Copy link
Author

@andresmtz98 Try this solution:
#16762 (comment)

@facebook facebook locked as resolved and limited conversation to collaborators Feb 11, 2020
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Feb 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Platform: Android Android applications. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

6 participants