question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to debug the app in Chrome, getting error : I Realm : Starting the debugging WebServer, Host: null Port: 8082 (adb logcat error)

See original GitHub issue

Hi I m unable to debug my app which has realm db, I see a white screen with nothing else, and also when I hit reload on the emulator, I m getting the following error while debugging in chrome console :

Running application "realm_mobile" with appParams: {"initialProps":{},"rootTag":1}. __DEV__ === true, development-level warning are ON, performance optimizations are OFF

POST http://localhost:8082/get_property:1 POST http://localhost:8082/get_property net::ERR_EMPTY_RESPONSE

POST http://localhost:8082/create_realm:1 POST http://localhost:8082/create_realm net::ERR_EMPTY_RESPONSE

Failed to execute 'send' on 'XMLHttpRequest': Failed to load 'http://localhost:8082/create_realm.

When the debugger is removed, the code runs as its expected. I have checked the other issues raised with similar behaviour issue-276. I have tried manually port reverse & forward

adb reverse tcp:8081 tcp:8081
adb forward tcp:8082 tcp:8082

I see the following error in adb logcat - I Realm : Starting the debugging WebServer, Host: null Port: 8082

I am using the following react(15.0.2), react-native(0.26.1), realm(0.13.0) versions. Is this supported ? Any help here from the logs attached and errors above would be appreciated.

Update : I have tried this on my android device also with same result. Without debugger, things work fine but once debugger is attached we get the white screen

Edit 1: Can you please look at this issue as it is blocking us badly. Thanks in advance.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:8
  • Comments:24 (6 by maintainers)

github_iconTop GitHub Comments

17reactions
TGPSKIcommented, Sep 27, 2017

Greetings, I have a working implementation for Android.

Versions

  • OS: OSX 10.12.3 (16D32)
  • React Native: 0.48.4
  • Realm: 1.12.0 + Port update patch

Steps

  1. Add a postinstall script to your package.json:
... 
"postinstall": "bash ./scripts/patch_realm_port.sh",
...
  1. Add the project/scripts directory && touch patch_realm_port.sh

patch_realm_port.sh

#!/bin/bash

# android
perl -0777 -i -pe 's/(?mi-s)(private static final int DEFAULT_PORT = 8082;)/ private static final int DEFAULT_PORT = 8083;/g' "./node_modules/realm/android/src/main/java/io/realm/react/RealmReactModule.java"

# ios
perl -0777 -i -pe 's/(?mi-s)(#define WEB_SERVER_PORT 8082)/#define WEB_SERVER_PORT 8083/g' "./node_modules/realm/android/src/main/java/io/realm/react/RealmReactModule.java"
  1. Run yarn install on your root dir

  2. Build android release

  3. IMPORTANT: run the following adb commands

  • adb reverse tcp:8081 tcp:8081
  • adb forward tcp:8082 tcp:8082
  • adb forward tcp:8083 tcp:8083
  1. Start node server

  2. Launch android debugger & run

6reactions
Komeyl94commented, Apr 24, 2018

For me running the following commands fixed it, thanks to @TGPSKI’s suggestion:

  • adb reverse tcp:8081 tcp:8081
  • adb forward tcp:8082 tcp:8082
  • adb forward tcp:8083 tcp:8083
Read more comments on GitHub >

github_iconTop Results From Across the Web

Using Realm and Remote Debugging fails on android
I've met this problem when I've used react native with realm database. ... app's Developer menu -> Dev settings -> Debug server host...
Read more >
Android Debug Bridge (adb) - Android Developers
Android Debug Bridge ( adb ) is a versatile command-line tool that lets you communicate with a device. The adb command facilitates a...
Read more >
Access local servers - Chrome Developers
Set up remote debugging between your development machine and your Android device. · Click Port forwarding button. · Check Enable port forwarding.
Read more >
ERROR running Appium command: This method requires that ...
error : Error killing ADB server, going to see if it's online anyway. info: [ADB] Getting connected devices... debug: Appium request initiated at...
Read more >
Network Tracing | Android - Google Developers
Assuming you have developer options enabled and the feature is available, your screen will look like this: Select the Enable debug logging for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found