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 breaks emulator networking #13340

Closed
aem opened this issue Apr 6, 2017 · 8 comments
Closed

React native breaks emulator networking #13340

aem opened this issue Apr 6, 2017 · 8 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@aem
Copy link

aem commented Apr 6, 2017

Description

Quite frankly, I'm not entirely sure. As background, I'm trying to integrate react-native into an existing app. I've followed all of the instructions and for a while successfully had React code running alongside native Android code. A couple of days ago I got a new laptop from work and when I tried to run this code on the new laptop nothing was working.

I went back and made sure I had watchman and all other external deps installed, double-checked all of my code and it all appears to be ok, but for some reason my component never mounts. Constructor never gets called, log statements in componentDidMount are not executed, nothing. I know the JavaScript is loaded properly because log statements in index.android.js execute properly, so I'm fairly confident that there's no issue with my JavaScript. However, when I try to mount a component that is registered with AppRegistry it doesn't work properly.

I've opened a Stack Overflow question here to no avail.

Reproduction Steps and Sample Code

The relevant code to mount my component and the component itself are described in the SO question linked above.

Solution

Hopefully someone with more experience with RN internals might have seen this before? I'm genuinely at a loss. I've done everything from wiping out node_modules to wiping the Android SDK and removing all emulator instances from my laptop and starting from scratch. Nothing has remedied the issue.

Additional Information

  • React Native version: Attempted with both 0.42.3 and 0.43.0
  • Platform: Android
  • Development Operating System: macOS 10.12
  • Dev tools: Android Studio
@aem
Copy link
Author

aem commented Apr 6, 2017

Sorry. Forgot to include this in the original issue. My guess that it's related to react native breaking networking is because exclusively when running a my react-native project (only on the branch that has react-native, master doesn't have this problem, and no other Android projects cause this) the following message is logged to the emulator console (output of ~/Library/Android/sdk/tools/emulator, not the application logs themselves) every 3-4 seconds:

CANNOT TRANSLATE guest DNS ip

@taylorren
Copy link

I agree with @aem.

I am running react-native generated programs and this message keeps popping up. The emulator goes well on Internet surfing.

@mdjnewman
Copy link

mdjnewman commented Apr 10, 2017

The error is showing up for me as well, but I've tested a few things and it doesn't seem to be impacting the app.

Update, as far as I've tested, older Android tooling has no issues.

Versions:

  • react-native 0.42.3
  • Android gradle tools 2.2.+
  • Build tools version 23.0.1

Test with old Android SDK versions

I installed an older version of the Android SDK using this old Homebrew formula.

Emulator version:

$ emulator -version
Android emulator version 25.2.5.0
Copyright (C) 2006-2015 The Android Open Source Project and many others.
This program is a derivative of the QEMU CPU emulator (www.qemu.org).

  This software is licensed under the terms of the GNU General Public
  License version 2, as published by the Free Software Foundation, and
  may be copied, distributed, and modified under those terms.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

Targets:

$ android list
Available Android targets:
----------
id: 2 or "android-24"
     Name: Android 7.0
     Type: Platform
     API level: 24
     Revision: 2
     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
 Tag/ABIs : default/x86

AVD I created:

$ android create avd -n "Test" --target "android-24" --abi 'default/x86' -c 256M
$ android list avd 
Available Android Virtual Devices:
    Name: Test
    Path: /Users/mnewman/.android/avd/Test.avd
  Target: Android 7.0 (API level 24)
 Tag/ABI: default/x86
    Skin: WVGA800
  Sdcard: 256M

Starting the emulator, running the app using react-native run-android and opening a port to my API running locally using adb reverse resulted in no errors.


Test with new Android SDK versions

Install new tooling with brew cask

$ brew cask install android-sdk

Install a system image:

$ sdkmanager 'system-images;android-24;default;x86'

Install tools:

$ sdkmanager 'platforms;android-24'

Create AVD:

$ avdmanager create avd -k 'system-images;android-24;default;x86' --name Test

Starting the emulator, running the app using react-native run-android and opening a port to my API running locally using adb reverse resulted in errors printed to the console, but the API calls still worked

@NameNull
Copy link

same issue

@fast-one
Copy link

Same issue

@baer
Copy link

baer commented May 20, 2017

See this issue on the Android issue tracker

https://issuetracker.google.com/issues/37139091

anujbiyani added a commit to anujbiyani/todo_demo_client that referenced this issue Jun 5, 2017
can't test it, getting CANNOT TRANSLATE guest DNS ip
facebook/react-native#13340
@charpeni
Copy link
Contributor

charpeni commented Jul 5, 2017

Thank you for this detailed issue.

Even browsing in Chrome trigger this error, however requests all seem to work correctly.

On a full React Native application, if the packager can't be reached a red screen will be displayed saying that it can't reach X ip address. While React Native integration into an existing application seem to just not work.

I'd say to verify every IP address in your application and be sure every connections can be reached. I had the same issue CANNOT TRANSLATE guest DNS ip, fix IP address fixed the application but I still get the same log output into my emulator. So I guess it's not being popped by React Native.

Just let me know if it was your case, so we can triage this issue.

@hramos hramos added the Icebox label Sep 21, 2017
@hramos
Copy link
Contributor

hramos commented Sep 21, 2017

Hi there! This issue is being closed because it has been inactive for a while. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. Either way, we're automatically closing issues after a period of inactivity. Please do not take it personally!

If you think this issue should definitely remain open, please let us know. The following information is helpful when it comes to determining if the issue should be re-opened:

  • Does the issue still reproduce on the latest release candidate? Post a comment with the version you tested.
  • If so, is there any information missing from the bug report? Post a comment with all the information required by the issue template.
  • Is there a pull request that addresses this issue? Post a comment with the PR number so we can follow up.

If you would like to work on a patch to fix the issue, contributions are very welcome! Read through the contribution guide, and feel free to hop into #react-native if you need help planning your contribution.

@hramos hramos closed this as completed Sep 21, 2017
@facebook facebook locked as resolved and limited conversation to collaborators Sep 21, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Sep 21, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

9 participants