Integrate viro-react into react-native project - react-native

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!

Related

Failed to intall the app in react native, how can I fix this?

I was trying execute myapp to android but an error occurred.
To clarify what happened, first time I install nodejs and Android Studio.
Later I used the following commands:
npx react-native init 'app'
cd app
npx react-native run-android
Its my fisrt time messing with react native, I was following this page:
https://learn.microsoft.com/pt-br/windows/dev-environment/javascript/react-native-for-android
And the error is:
The error
I want coding in real time for android app.
How can I fix this?
Looks like the terminal output gives you several steps to do/check.
Make sure you have properly set up your android environment. Use this link to do so. You can use Expo-Cli or React-Native-Cli.
SDK location not found. This could be an off-shoot error of not properly doing step 1. However, to cover all of your bases, ensure you have properly set up your Android Emulator. This doc is a great walkthrough.
Once your Android studio and AVD Manager is properly set up, and your development environment is properly set, you should have no issues!
Please let me know if doing the above to steps did or did not solve your errors.
If you follow the steps, https://reactnative.dev/docs/environment-setup and https://developer.android.com/studio/run/emulator there will be no problem.
As a React Native fan on Windows 10, I'd like to mention just few points you need to check.
First, please check following user variables in Environment Variables ( You can see it from System Properties).
adb="C:\Users{username}\AppData\Local\Android\Sdk\platform-tools"
ANDROID_HOME="C:\Users{username}\AppData\Local\Android\Sdk"
JAVA_HOME="C:\Program Files\OpenJDK\openjdk-11.0.15_10"
Path: check if contains {ANDROID_HOME}\platform-tools
Eg:"C:\Users{username}\AppData\Local\Android\Sdk\platform-tools"
Second, if you are using Android Sdk emulator, please make sure that it configured correctly in emulator list in Android Studio.
For an instance, I created a android emulator using android sdk-29 and you can check the followings.
Third, I recommend you, deploy first app on emulator in Android Studio.
Because we need to download gradle zip file and others, it's essential to run your first android app in Android Studio.
When you confirmed your first android app(Deploy empty project app is also okay), you can run your React Native App by Expo-cli or react-native-cli.

React Native white blank screen issue

Always getting white blank screen when running the app on the physical device in android case. Using react-native-navigation can't able to detect the bug please help!
I have created a fresh react-native project and integrated the react-native-navigation library into it and when I am running the app in my physical device by running the command yarn run android it runs but shows blank white screen in android. Once it runs successfully but now it won't.
run react-native start in a separate terminal and then run react-native run-android.
i recently faced two kind of white screen problem
1.always showing white screen (due to bundling..)
solutions is
react-native start
and then
react-native run-android
2.it shows white screen some particular seconds or suddenly always shows white screen in properly working app
due to app cache or traffic
solutions is
Androidmanifest.xml
android:usesCleartextTraffic="true"
If Debug JS Remotely is on then also we see the blank screen. I have recently come across this issue. So check if you are already running Debug JS Remotely. If you are running it already then just stop remote debugging. And it will work.
Running ./gradlew clean on android folder and then uninstalling the app from the phone worked for me.
In my case, was using my Phone to test and develop, and suddenly white screen issue appeared.
The app was not loading at all, no error, no code update only white screen comes up after npx react-native run-android.
My solution was to clear the phone cache as it was loading from cache.
I restarted my phone then cleared all cache and then it worked for me.
Use "react-native init" command for the creating the project as it only build react-native not expo and the other node modules for you and then build for the particular platforms for eg. in my case "react-native run-android" and it works.
There is step-by-step what I do to run app on physical android device:
Open 'android' folder from app folder in IntelliJ
Run in IntelliJ, target: USB device
After .apk finish installing, shift-right click in app folder, run PowerShell, type 'react-native run-android'
After it finish, open app on physical device, shake it to open developer menu, and hit 'Reload'
you can also hold menu button on your device to open developer menu(while app is running)
I also faced same issue in the emulator. So the way I solved it is by going into Android settings - Apps - select the app, and force stop it. Then I tried opening the app again and it worked.
Before I did this, I removed the 'build' folder under /android/app/ and re-ran. Did not work.
One thing that often resolves this problem for me is re-installing your node_modules folder and cleaning your gradle build. You can do this manually, however, if you've run into this problem once or many times, consider running a shell script to automate this process.
Create a file called clean.sh and paste this inside:
echo "Removing node modules from $1 then reinstalling..."
cd $1
rm -rf node_modules
yarn install
echo "Cleaning gradle project..."
cd android
./gradlew clean
cd ..
If using npm, change "yarn" above to "npm".
Put the file above in the parent directory of your project (if your project is located at C:\Users\your.name\projects\project1 put the clean.sh file at C:\Users\your.name\projects\).
To run the script, inside of Git Bash or your Unix terminal run this (make sure to change the name of the directory below to the parent directory of your project):
cd C:/Users/your.name/projects
./clean.sh <project-name>
Now when restarting your app, try also reset the packager's cache.
With yarn:
yarn start --reset-cache
yarn android
With npm:
npx react-native start --reset-cache
npx react-native run-android
In my case I had a metro terminal running from my previous project. closing it and running the new project again solved the issue.
Use react-native-splash-screen. I try many ways to fix this issue but it's not working and i think this is the best way.
For me my wifi was disconnected on my test device.
I had to make sure both my computer running the react packager/server and my device were connected to the same wifi network.
I have recently faced this kind of white screen problem
1.always showing white screen after Release
"npx react-native start"
and then
"npx react-native run-android"
2.it shows white screen some particular seconds or suddenly always shows the white screen in a properly working app
due to app cache or traffic and android Newer version also in some case when you are using API with HTTP instead of HTTPS
The reason is that newer android versions are more secure and they try to restrict HTTP request
solutions are
add this line in path project\android\app\src\main\androidmanifest.xml:
android:usesCleartextTraffic="true"
In my case:
1: I tried npx react-native start to run metro.
2: Then write npx react-native run-android in cmd, there was still a white blank screen.
3: I still faced the same issues, then I always comment on every single component, and automatically, I resolve the error. This is the best technique I ever used.
If you are trying to get it working on a Android device, make sure you have first tried to clear cache for the App, doesn't matter if reinstalled.
Try the other answers only after you have cleared cache.
It can not find its navigation's route. You should check the navigation.

React Native app crashes without any error log

React Native app crashing without any error log. No output on "react-native log-android" terminal, no red screen with error, Android emulator just crashes. Tried running with Expo, again crashes with no error
Happens when working with TextInput. I have some ideas how I can fix the code, but want to understand why is app crashing without error log and making debugging much more difficult?
my bug was fixed by deleting the build folder(inside android/app) and running
npx react-native run-android
Run adb logcat
You can find your app name in your package.json, under the name field.
Also when looking for errors specifically dealing with react native, try running
adb logcat | grep 'redbox'
This way you don't have to scan the entire logfile.
Or try the method shown in this article:
Run adb logcat *:S ReactNative:V ReactNativeJS:V in a terminal to see your Android app's logs.
I was running an Android Project on my Linux PC, then I have made some changes on it in a MacOS PC, and when I git pulled de project back to Linux I faced that crashes
inside the android folder, just run:
./gradlew clean
and then try to run it again.
In case none of these work, don't hesitate to just filter on Warning or Higher as sometimes there will be a low level error that will not be caught by the RN filters.
I was only able to find my issue(s) with the following:
adb logcat '*:W'.
In case react native app crashes without an error message checking the problem in Android Studio's Logcat works perfect. But don't forget to create a filter with your package name.
Open Android Studio
Open Logcat
Click on "Edit Filter Configuration" in the right top of the logcat screen
Fill in your criteria (don't forget package name)
Run you react native project on an android device or emulator
This may be because SOLoader is absent.
Ensure
implementation'com.facebook.soloader:soloader:0.9.0+'
is added under dependencies in android/app/build.gradlle
clean your build
cd android
./gradlew clean
Try bundling
./gradlew bundleRelease
Exit android folder
cd ../
Try running
npx react-native run-android --variant=release
My app kept crashing because I had changed the name of the app in a few places. Make sure your app name is the same everywhere.
Check if the folder name in
android/app/src/main/java/com/<appname>
has the same name as that of your app in manifest file in
android/app/src/main/
My RN App works correctly before, suddenly one day it does not work, keeps crashing without error log. All I have to do is: delete build and .gradle folder under android folder, then run again, it works. Hope it may help someone.
this worked for me
run react-native start --reset-cache
after this if app throws some import error kill the task and run react-native start or npm start normally and open the app.
Deleting my node_modules, reinstalling them and run
npx react-native run-android
fixed it for me
While running your Android Emulator for debugging also run
Android Studio -> Tools -> Android -> Android Device Monitor
It will tell you exactly what is crashing the app under LogCat tab.
two easy steps solved my problem...
open android studio and remove offline bundle from src/main/assest..(** if any)
open MainApplication.java and remove the following import..
import com.facebook.react.BuildConfig
I had the same issue, maybe you made the same mistakes i did.
Make sure u didn't change the app's package name (ex: com.myapp.app).
I lost a lot of time on this. Seems like someone else published a app with the same name on google play, and i didnt change it correctly in each place i should on mine.
Anyway, if that is not your problem, it is probably in something u changed in build.gradle or other config file, try to remember where u last changed something.
Was having this issue on Windows 10
What fixed it for me in the end was:
delete C:\Users\%userprofile%\.gradle\caches
deleteyour-react-app/android folder completely - then 'Discard Changes' in git so you get the original files back
re-run npx react-native start and npx react-native run-android
A tip, my emulator api version was 32. And my targetSdkVersion was 31.
I created another emulator which api level is 31 and the error is gone.
Well first of all, does it crashes when it opens or does it crash at a specific screen? Mine crashed because I did not put my text inside <Text></Text> inside the TouchableOpacity
a very simple solution for me.
delete this file -> gradle-wrapper.properties
and run android folder with android studio.
In case you tried any of the given suggestions and none worked, use Android Studio to run the app in debug mode and then watch logs at the debug console.
For me, it was a styling rule error. I did
paddingTop: Platform.OS === 'ios' && 50 which caused the app to exit immediately on Android.
The debug console log I got was E/unknown:ViewManager: Error while updating prop paddingTop
To correct that, I did paddingTop: Platform.OS === 'ios' ? 150 : 0
Delete Your node modules
Then run npm install
after this run
for window
gradlew clean
for macOS
./gradlew clean
then run
npx react-natie run-android --variant-release
or
npx react-natie run-android

react-native run-android hangs on scanning for folders

Trying to run react-native run-android just outputs:
Scanning folders for symlinks in C:\Users\Matt\sites\rg-calendar\node_modules (136ms)
Any ideas?
Me too had this problem,and i solved it by simply closing and opening the terminal after that i was able to successfully execute the react-native run-andorid
Sorry for being late, but hope it helps somebody.
It appears there are two ways to create a react native project.
create-react-native-app
react-native init
The first method is used when you want to use Expo to run your app, and the second is used when you want to run the app using react-native run-android. When I use method 1, trying to run react-native run-android behaves the same way yours did in that screen shot. Using method 2 allows me to run the app using the aforementioned method, which is what you tried to do.
try update with:
npm i
and if doesn't work check what file(s) or folder(s) delete or edited wrongly !
if problem is about connecting to the real device first check the adb and adb devices , then try this code:
react-native run-android --deviceId {YOUR DEVICE ID IN ADB DEVICES}

Unable to run react-native release build

I am trying to deploy my react-native app to android. I follow the steps on this page
https://facebook.github.io/react-native/docs/signed-apk-android.html.
When I try to run it, it tells me
not such file or directory '.../assets/index.android.bundle'
or I get
Task 'installReleaseDebug' not found in root project 'awezaEduApp'
Using Windows 10 and react-native 0.39.2
OUTCOME
I ended up having to reformat my laptop for other reasons and when i repeated the signing process it worked. On account of my previous efforts, prior to reformatting, I would presume that Eldelshell's answer would have solved it.
Note: I think that running gradle tasks in Android Studio's terminal would also work.
You need to execute react-native run-android at least once. Don't worry if it fails because you don't have the emulator running.
or I get Task 'installReleaseDebug' not found in root project 'awezaEduApp'
You have to execute gradle inside the android folder.
Task 'installReleaseDebug' not found in root project 'awezaEduApp'
For RN 0.39.x, you have to run the following for release build:
react-native run-android --configuration=release