React-Native run-android basic Getting Java.Net.UnknownHostException - react-native

I am a beginner in React Native and i have followed all the steps carefully as suggested in react-native Get-Started. Once the project is initiated and i try to run the same using run-android command, I am getting "java.net.UnknownhostException". To be particular, this issue is happening during gradle(https://services.gradle.org/distributions/gradle-2.2.1-all.zip) download.
I am on a corporate network and I have done the proxy setup as well in gradle-home/properties. I have tried downloading the gradle file manually and it works fine in my browser.
Any leads in fixing this issue is highly appreciated.

I think this link can solve your problem:
https://github.com/facebook/react-native/issues/2726
Edit gradle.properties in android sub-folder with the following details:
systemProp.http.proxyHost=proxyHost
systemProp.http.proxyPort=proxyPort
systemProp.https.proxyHost=proxyHost
systemProp.https.proxyPort=proxyPort
systemProp.http.proxyUser=YOUR_USERNAME
systemProp.http.proxyPassword=YOUR_PASSWORD
systemProp.https.proxyUser=YOUR_USERNAME
systemProp.https.proxyPassword=YOUR_PASSWORD

Related

Gradle error in resolving react-native-reanimated dependencies

I am facing the error below in the picture when I am trying to build my react-native app on android emulator.
To give more detail it gets stuck in configuring phase when performing:
(:react-native-reanimated > Resolve dependencies of :react-native-reanimated:classpath > gradle-7.3.0.pom)
(By the way, ios simulator works perfectly fine!)
Version of the packages that I am using:
"react-native": "0.70.1",
"react-native-reanimated": "^2.13.0"
Can anyone help me with this?
Well I am going to post the answer myself, but this will only be useful for developers who work in locations in which google services like Android are sanctioned.
The problem was simply my internet connection being unable to download the react-native-reanimated:classpath.
So to solve this issue or any other similar issue in the configuration phase, you have to use a VPN to change the source of request to be able to download the required packages to get your build.

I am building an app using Expo but for some reason all of a sudden the 'npm' start command no longer works

I am fairly new to React Native. I am building a basic app using expo-cli. I don't have a deep understanding on how it works, but I've been following tutorials online on how to use it. Today, I was working on it and used 'npm start' command to launch the expo portal so I could demo my app on a virtual machine but it says it can no longer find the link to the .json file. Can someone please help me to get it working again.
Looks like you're one directory up? Try cd WhatsUp and then run npm start again.

React Native Example App does not run in Expo Snack

I'm learning React Native and trying to add a component to an Expo Snack for testing. I can't even get the example app to work though.
Is it something different about how Snacks work vs. a desktop development environment? I've encountered that type of difference using JSFiddle, for example.
I straight copy-pasted the code from the Github repo into snack.expo.io and it gave me an error:
Device: (946:881) Unable to resolve module 'module://expo-font.js'
Evaluating module://expo-font.js
Evaluating module://react-native-numeric-input.js
Evaluating module://App.js
Loading module://App.js
I've gotten this error before, but I've never been able to figure out why. Is it an issue with the package, which was updated just 7 days ago, or something else? Please advise.
It may be due to missing of node modules in your project compared to the Github project. As the Stack.expo browser won't give us full freedom to install custom modules, I suggest you to download VS Code and open the Github project in it, then do "npm install" from cmd and "react-native run-android/ios".

Integrate viro-react into react-native project

Anyone here managed to integrate viro-react into react-native project? I followed the instruction in
the documentation
After that, I executed the project but not able to run.
This is the error that I got
Even though I run with gradlew installOvrDebug, still it failed.
If your configurations are correct then try running with any of these variants
ArDebug, GvrDebug or OvrDebug
Example running apllication with Augmented Reality:
Android
react-native run-android --variant=ArDebug
iOS
react-native run-ios --variant=ArDebug
I solved this problem with the following method:
Go to the Navigate to the node_modules/react-native/local-cli/runAndroid/runAndroid.js file and edit the lines that include installDebug change it to installArDebug
Go to the terminal and npm start
Open another terminal and react-native run-android
*Make sure that your device is plugged in and that you have android studio sdk paths in your environment variables. This should do the trick!

flow error messages in react-native

I was using this guide to setup vscode before starting a react native project (tutorial link).
After installing flow-bin, reactive native library compnents are showing lots of errors. Although, the test project is running fine. Here is the screenshot for the same:
Can some help me for if I have missed something?
Thanks in advance!
by adding this in .flowconfig [options] section:
unsafe.enable_getters_and_setters=true
The error asked in this question will be fixed.