Reputation: 2449
Importing and using Realm on react native works fine for iOS. Android also works in terms of functionality, however, when using remote debugging on chrome the following error yields.
I've looked around almost everywhere and nobody seems to have a clear cut answer for this. Anyone here that has managed to get out of this pit? Remote debugging is quite essential as the app is dealing with rather complex objects and using react-native log-ios
is a little hard on the workflow.
Thanks all.
Upvotes: 3
Views: 3774
Reputation: 553
Doing this worked for me
on terminal:
adb reverse tcp:8081 tcp:8081
adb forward tcp:8082 tcp:8082
adb forward tcp:8083 tcp:8083
Upvotes: -1
Reputation: 1180
I was able to resolve this issue in my pixel_3XL simulator android API level : 29
reset the path for platform-tools changed my PATH to platform-tools
$ export PATH=${PATH}:/root/Android/Sdk/platform-tools
$ adb kill-server
$ adb root #will give root access for adb
$ adb forward tcp:8082 tcp:8082
$ adb reverse tcp:8081 tcp:8081
$ react-native run-android #restart the server with a debugger enabled
voila, it worked in my machine... good luck.
additionaly try changing the ip to 127.0.0.1 and port manually in app's Developer menu -> Dev settings -> Debug server host & port
Upvotes: 0
Reputation: 935
Easy fix is to goto node_modules/realm/lib/browser/rpc.js
and replace line 216 with let url = 'http://127.0.0.1:8083/' + command;
Upvotes: 3
Reputation: 1307
if answer from @johnny didn't work, when you type the commands
adb reverse tcp:8081 tcp:8081
adb forward tcp:8082 tcp:8082
and you get the following message
adb server is out of date. killing...
* daemon started successfully *
that means that the adb command you are using in command line, and the adb tool used by the emulator are different.
you can confirm that by checking the location of adb (here I have two different tools in /usr/bin and /home, which are not symlinks as verified after)
42:~/pathToMyApp$ whereis adb
adb: /usr/bin/adb /home/42/Android/Sdk/platform-tools/adb /usr/share/man/man1/adb.1.gz
I tried with the full path on both tools, and I discovered the emulator was using the adb tool in /home/... So to make it work I now type
/home/42/Android/Sdk/platform-tools/adb reverse tcp:8081 tcp:8081;
/home/42/Android/Sdk/platform-tools/adb forward tcp:8082 tcp:8082
Upvotes: 1
Reputation: 76
You're running into known issues w/ android remote debugging, but they're being worked on. You can track progress here: https://github.com/realm/realm-js/issues/491
Upvotes: 2
Reputation: 2478
I've met this problem when I've used react native with realm database. I think you need manually port reverse and forward to avoid conflict port.When you enable debug mode, please open command line and follow below command:
`adb reverse tcp:8081 tcp:8081`
`adb forward tcp:8082 tcp:8082`
Then, you can reload and go into debug mode.
Cheer!
Upvotes: 1