I am trying to run a react-native app on android emulator, but I am getting an error like
Error calling Appregistry.runApplication
AVD: 'Nexus_5X_API_23(AVD) - 6.0
OS:Windows 10
Please help on this?
I had almost the same problem you currently have a few days ago. For me it was a real device.
From all my research, the solution that worked for me is the following :
When you launch your app by typing react-native run-android, the error appears.
So, reach your directory containing "adb.exe" ( for me it was C:\Users\username\AppData\Local\Android\Sdk\platform-tools\ )
open a terminal from here. And type adb reverse tcp:8081 tcp:8081
Then, by reloading the app on the phone, it should work.
I hope this will help you !! ( if not, shame on me )
Cheers ;)
EDIT :
I've find a more convenient solution to solve this problem.
When you launch your "react-native run-android" you might have a comment saying "adb is not recognized as internal or external command..."
Well, instead of manually using the adb command, you can add an environment variable leading to the adb.exe.
Just get to the "Control Panel" > "System and Security" > "System" > "Advanced System Settings".
From here, click on "Environment Variables". Search for the "Path" variable in the "System Variables" section. Click on it and press the "Edit" button.
There you can add a new path to this variable. Just click the "New" button and write the adb.exe path. For exemple C:\Users\username\AppData\Local\Android\Sdk\platform-tools\
(For the oldest versions of Windows, you'll have to add ";C:\Users\username\AppData\Local\Android\Sdk\platform-tools\" to the content.)
This is it, now the adb reverse tcp:8081 tcp:8081 command will be ran automatically upon building.
Hope this will even more helps you !
I had the same issue, my fix was to run
$ react-native start
in the background then run
$ react-native run-android
According to me this error comes when:
1) You did not run the packager at the right place i.e, you hit the wrong folder to run react-native packager so just navigate to your project's directory and run react-native start.
2) when you code something wrong with respect to Appregistry module.
3) Shutdown everything Xcode, packager, simulator etc and restart it again.
4) From the error one thing strikes in my mind is the name of the module
AppRegistry.registerComponent('AppName', () => componentName)
matches with the #"AppName" on your AppDelegate.m on the call for
[[RCTRootView alloc] initWithBundleUrl:...
moduleName:#"AppName"
launchOptions:...
5) As we are using react's component so we need to give the first character of our class name with caps on.
6) Let's see what's wrong in index.android.js and index.ios.js
Cheers :)
Finally, I got it working.I created a new AVD
Nexus6 API 23
.Earlier I was trying with Nexus5x API 23.Thanks all
I had same problem. It occurs that McAffee was on port 8081 and block packager.
My solution:
react-native start --port your_port
In android emulator, Command + M show dev menu, click on "Dev Settings" and then click on "Debug server host and port" and set it to your_ip:your_port.
Then
react-native run-android
In my case (after, of course, going through everything I could find here and elsewhere), I realized I had turned my WiFi off on my phone...doesn't work like that! Hope it helps someone
I had the same issue and was able to resolve it by setting my local computer as the debug server in the android emulator. Open the android emulator, Command + M to bring up a menu, then click on "Dev Settings" and then click on "Debug server host and port" and set it to 127.0.0.1:8081. Then from within you project directory run react-native run-android. I hope this helps.
Make sure that port 8081 is available. In my case One of my services is running on Port 8081(tomcat webserver).
I was having the exact same issue (because this is a very generic message) but the problem was different. In my case it was a newly created project, the emulator wasn't working but a real device did work.
My problem was the limit of watchers inotify can handle on Linux by default, which is a Linux kernel subsystem that acts to extend filesystems to notice changes to the filesystem, and report those changes back to applications and it's widely used, including android studio and react native; by the time I was trying to execute react-native run-android all of the watchers were allocated on my system, causing the process to fail on this same message.
To change the max amount of watchers inotify can handle, you need to edit the file sysctl.conf, which will be usually located at /etc/sysctl.conf or /etc/sysctl.d/custom_name.conf and add the following line:
fs.inotify.max_user_watches = 5242881
After writing the file you need to execute sysctl -p filename.conf where 'filename.conf' is the path and name wherever you saved the .conf file for sysctl. Once changes are applied everything should work as expected.
I too had the same problem. I solved the problem to run on real device.
As told by Mr Jedi, McAffee blocked the port 8081. So I have modified Project-Folder>\node_modules\react-native\local-cli\runAndroid\runAndroid.js file's function from
function tryRunAdbReverse(device) {
try {
const adbPath = getAdbPath();
const adbArgs = ['reverse', 'tcp:8081', 'tcp:8081'];
to
function tryRunAdbReverse(device) {
try {
const adbPath = getAdbPath();
const adbArgs = ['reverse', 'tcp:8081', 'tcp:3040'];
and started the application on
react-native start --port 3040
For me I just needed to add the platform tools to my Path environment variable so that react-native can start the adb server.
I was getting:
'adb' is not recognized as an internal tool or program
To fix this I added the following to my Path environment variable.
C:\Users\<Username>\AppData\Local\Adnroid\sdk\platform-tools
Then running react-native run-android worked!
I know this question has been given so many answers but, I think it's worth it adding my solution, hope this helps someone out there.
In my case the problem was from my virtual machine, although I didn't investigate but by creating a new virtual device the app ran smoothly with no problem.
So just create a new virtual device. :)
I searched for a solution for my registry error for a week and tried all these solutions, and all that was missing was I needed to add in my app.json file under expo:
"platforms": [
"ios",
"android",
"web"
],
So, if all else fails, try to add this into your expo.
Related
guys, I'm totally new here and I'm hoping I really get the help I need 🙏🏼
I built an apk package with eas build -p android --profile test, the build was successful. App installed successfully on mobile but it fails to open. once clicked, it just opens then immediately closes back.
I’m all new to expo and development in general.
I saw a documentation to run the app via npx expo start --no-dev --minify ; as this mimics production mode in local server. I did that and It returns a “uncaught error: java.lan.exception:failed to load all assests” I reloaded like 4 times and app opens fine after that. And does not bring the error again when I rebundle app.
However I have observed it brings the error (java.lang.exception:failed to load all assests) once everytime I stop and restart the expo server.
But app doesn't launch at all when I build to standalone.
Please help here, how do I fix this? 🙏🏼
This is the way I solved it
Follow the steps.
1.) Turn on USB Tethering & USB Debugging Mode in your mobile.
2.) Connect your mobile to your laptop through USB.
3.) Verify the connection options on your device, I just added WIFI bridge / I assume i the same as wifi debugging and then, restarted the device and run expo and it worked.
Above solution is worked for me.
I am pretty new to React, sorry if I am asking something stupid. Any help would be highly appreciated :)
ENVIRONMENT
Ubuntu 20.04 in Windows 10 (WSL2)
Node version - v14.1.0
Npm version - v6.14.7
Code editor - VS Code v1.14.0
STEPS I DID
npx create-react-app <app-name>
cd <app-name>
npm start
https://localhost:3000 opens up in browser with default React landing page. Console says '[HMR] Waiting for update signal from WDS...
'
Delete all files in src directory and create empty index.js in src directory.
Output expected: Blank screen
Output: Default landing page of React even if I reload the page.
Struggles I made before asking this question :(
Looked in issues of create-react-app.
Tried troubleshooting create-react-app as mentioned in official docs.
Looked in stackoverflow for similar questions. Found some but none worked, maybe because my dev environment was different from them (WSL2 in Windows 10).
That sounds like a caching issue to me. My guess would be to clear your google chrome cache and try again. If that doesn't work, check your package.json file and make sure that under "scripts": "start" it says "react-scripts start".
Yayy! The issue is resolved.
It was my mistake :(.
All these days, I was trying to access the Windows filesystem from WSL2 and it seemed to be very slow. So I decided to work in the Linux filesystem itself. And everything works fine now. Thanks for helping :)
enter image description here
Im new to React-Native and this is driving me insane, I just want to launch the project in the and view the project in the emulator so I can just start coding, I have tried downloading the latest version of JDK, which is apparently not even needed since android studio comes bundled with its own version & also how do I know what version of JDK my android studio comes bundled with ?
I have been trying to fix this for days now, I even got Blue screen of death when after I messed around with the enviroment variables so now I am desperate and want someone to point me in the right direction.
React native install app on a single running device. Make sure your emulator is in running condition
check all connected devices which are eligible for installing using a command
adb devices
one device at a time
Please check your JDK path for android and ios, if all things are correct the see the project files in the project.
Then run your project.
I hope it runs.
Description
I am following along with the instructions here: https://www.gatsbyjs.org/tutorial/part-one/
When I start the dev server and make a change to src/pages/index.js it is not hot reloaded in my browser.
Steps to Reproduce
Using gatsby-cli:
gatsby new hello-world https://github.com/gatsbyjs/gatsby-starter-hello-world
cd hello-world
gatsby develop
change the text inside of the div in src/pages/index.js
Expected Result
Page would automatically reload with new text.
Actual Result
Page would not change unless a manual refresh was applied in the browser.
Specs
OS: Ubuntu 18.04.3 LTS running in WSL on Windows 10 Pro
Node: 12.12.0
NPM: 6.11.3
Gatsby CLI: 2.8.8
Gatsby: 2.17.6
Browsers: Chrome 77.0.3865.120, IE 11.1006.17134.0, Firefox 70.0
I've tried multiple browsers with the same result so I ran devtools in firefox and examined the console output when I make a change and I see this error:
The connection to http://localhost:8000/__webpack_hmr was interrupted while the page was loading. client.js:88
[HMR] Update check failed: hotDownloadManifest/</request.onreadystatechange#http://localhost:8000/commons.js:42:16
process-update.js:147
Error: Manifest request to /d528b21bff3fd2caa92d.hot-update.json timed out. bootstrap:41
Firefox can’t establish a connection to the server at http://localhost:8000/__webpack_hmr. client.js:88
I've also looked around on github and here and haven't found a solution to my problem. Any ideas on a workaround, solution, or insight into why this might not be working for me would be greatly appreciated!
I was having same problems. Gatsby Develop hot reload was not working whenever I made changes to files, plus, Gatsby Develop was terribly slow to compile code and get the dev server up and running. I found out that if I create my Gatsby project in Linux directory structure instead of Windows, everything works out good and is blazing fast. So my solution was following.
Create your project in /home/<your_username> directory in WSL. Simply go to /home/<your_username> and make a folder there with mkdir; go to that folder and then run Gatsby create my_project command in that folder.
That way your project will reside in Linux directory structure, making everything run smoothly.
I faced the similar scenario today. Below steps made it work however warning message is persistent in the console.
Delete package.lock.json and node_modules folder
Delete the content present inside C:\Users\\AppData\Roaming\npm and npm-cache
Do a npm i.
Im running gatsby develop on windows. After trying many things, including wsl, npm clenaup etc, I realized that my antivirus sophos was blocking the webpack hot reload socket __webpack_hmr.
All I had to do is to disable the antivirus for a while. ( You are free to uninstall it or maybe change to another one ).
hope it works for you ;)
I have tried to install meteor js 1.1 on windows 8.1 with the official installer:
https://github.com/meteor/meteor/wiki/Preview-of-Meteor-on-Windows
But even after restarting my computer, when I type the command meteor in the command prompt I get the error command not found.
Even after a search on my computer to find the installation folder of meteor, I am unable to find the answer. However, in the add/remove program utility, I can see meteor.exe.
As a note, I already successfully installed meteor before, and it used to run smoothly. In the meantime, I have removed and re-installed node, and it seems that since this moment the command meteor does not work anymore. Hence my attempt to re-install it.
Does anyone have any idea about how to troubleshoot my issue ?
I just solved my issue by using the windows command prompt instead of the git bash
It appears that only windows command prompt is supported so far.
You can try to manually add Meteor to your Path.
Go to "Environment variables" (you can find it by doing a simple search in your welcome screen) and add the following entry:
C:\\Users\\**your_user_name**\\AppData\\Local\\.meteor
Do not forget to separate this entry from other entries by a semicolon ;.