Using Realm and Remote Debugging fails on android - javascript

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.

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;

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

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!

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

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

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

Related

Connection error while installing react native cli via npm

I have been going step by step by the official instructions that are on react native site in the dev OS I have Windows and in the target OS I have Android. The installation via choco went well but when I try installing it with:
npm install -g react-native-cli
it starts normal like this:
but then after a while it returns just these errors:
I have already tried changing proxy and making it "the right way" but it just keeps crashing like this. Btw I have proxy on http://domain:8080/
Any ideas how to fix this pls?
The final solution was very simple. If someone has same problem as this and is sure they are not on proxy, try pinging ipv6 address. If it doesn't answer then there is the issue. Just unclick ipv6 and it will work just fine.

Launching on android WEBAPP with ADB

Is there a method to launch a web app using adb?
The web app is created using manifest.json and save on android using chrome browser.
I've tried to get the package name of the web application using adb shell pm list packages but nothing seems to match.
I want to launch my web app this way adb shell am start -n com.package.name/com.package.name.ActivityName
I've also tried this way adb shell am start -a android.intent.action.VIEW -d "url". This works but it is not what I am looking for.
Assuming you are coming from Javascript world (as you could have done this by looking at adb logs), this should be what you are looking for
adb shell am start -a com.google.android.apps.chrome.webapps.WebappManager.ACTION_START_WEBAPP -n com.android.chrome/org.chromium.chrome.browser.webapps.WebappLauncherActivity --es "org.chromium.chrome.browser.webapp_url" "{your_url}" --es "org.chromium.chrome.browser.webapp_mac" "{webapp_mac}"
Note that this url has to match the url/url-ending you have mentioned in the start_url that you have mentioned in the manifest.json of yours, else it will just open it as another chrome tab.
Another caveat here is you have to pass web app mac validation check, which is done by the core android class mentioned here - WebappAuthenticator
Chrome does not keep a store of valid URLs for installed web apps
(because it cannot know when any have been uninstalled). Therefore,
upon installation, it tells the Launcher a message authentication code
(MAC) along with the URL for the web app, and then Chrome can verify
the MAC when starting e.g. {#link #FullScreenActivity}. Chrome can
thus distinguish between legitimate, installed web apps and arbitrary
other URLs.
I gave it a shot to open one of the webapps I own. I gave up after a bit, getting lost in the cryptic algos. Maybe you will have some luck with it. All the best!!!

Meteor server crashes very frequently without any error

I am working with the Meteor application and I deployed the same over EC2 instance. It was working fine till a few days back.
But now the server process kill automatically without any error log or
console
I tried to get the error but unfortunately, as there are not any logs I am unable to find out why the server is crashing again and again.
I have a medium EC2 machine on which the application is running.
I am using nohup for running the application in the background.
Below is the command I used to start the server:-
nohup meteor --settings SETTINGS-PRODUCTION.JSON &
I am wondering to know about server crashes due to nohup or some other reason is there.
Please let me know how we can console uncaught exception in the meteor-like we do in express.
What should I use to auto restart the server if the process is killed
by any error or exception?
Any help would be much appreciated!
Thanks
Using nohup is quite a low-tech solution. Things like Phusion Passenger, PM2, or forever do a better job.
Also your docker container can be configured to automatically restart the process.
Even better is a tool called Meteor Up, which makes it really simple to deploy Meteor apps to EC2.
EASILY DEPLOY YOUR APP Meteor Up is a production quality Meteor app
deployment tool.
Install with one command:
$ npm install --global mup
http://meteor-up.com/

Why is the error happening?

I'm following this tutorial Full-stack Redux Tutorial and everything went well till the moment I had to run a local server (Starting under the title "Setting Up a Socket.io Server"). I copied exactly what the tutorial shows and I'm getting this error when running "npm run start"
As seen in the image, the command I'm trying to run is:
babel-node index.js
But the error says nothing I can catch, just that something is wrong with the command, not even with a file.
I'm lost and Google offers little help.
Something else is listening on port 3333 on your machine. Change the port number to something else, and it should work.
If you told us what OS you were using, we could suggest how to determine what is listening on port 3333.
It seems like there's still a connection open on port 3333. If you open cmd and run netstat -a -b you should be able to get a list of open connections together with the executables that started them.
It might be that your Socket.io server previously crashed and the exception wasn't handled properly, possibly leaving the connection open?

Permission Denied When Trying to use --browser in JSTestDriver on OSX 10.6

I started playing around with JSTestDriver tonight and got it to work without too many issues. I attempt use the --browser switch to have it autocapture chrome or firefox on my local system here; however, it always threw an error saying "permission denied". I attempted to run the command using sudo and still the same thing.
java -jar $JSTESTDRIVER_HOME/JsTestDriver-1.3.2.jar --port 4224 --browser /Applications/Firefox.app
I can open Firefox using the above path from Terminal so know that the path is valid.
I feel like I'm missing something simple and small. Has anyone seen this issue and know what I'm missing?
UPDATE 1:
Tried to move Firefox out of the /Applications/ directory and still same issue even running under the super user account (using sudo).
Found my issue.
While /Applications/Firefox.app is what's shown the GUI, the actual executable script for the program is in the /Applications/Firefox.app/Contents/MacOS/firefox file.
Changing the path to the deeper folder resolved the issue.

Categories