A problem occurred configuring project ':#sentry_react-native' SDK location not found - react-native

I'm on MacOS trying to run a react native (0.59.9) app on Android emulator. I've integrated Sentry using the wizard. Works fine on iPhone. On Android, this happens:
I try to run the app w/ react-native run-android
Build fails.
A problem occurred configuring project ':#sentry_react-native'.
SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.
I go into the android folder and create a local.properties file and paste this in:
sdk.dir=C:/Users/my_name/Library/Android/sdk
I try again to run the app w/ react-native run-android
Build fails.
A problem occurred configuring project ':#sentry_react-native'.
The SDK directory '/Users/my_name/project_path/android/C:/Users/my_name/Library/Android/sdk' does not exist.
Why is it concatenating the SDK dir w/ my project path? That doesn't make sense to me. How do I fix this?

this isn't a Sentry issue, but an Android environment issue, please look at https://reactnative.dev/docs/getting-started.html and set your Android env. properly.
Look for "Android development environment", good luck :)

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.

cannot able to run react native project by android emulator

Error when try to run
I am having react native project and iam trying on android emulator via below command
react-native run-android
but its not working getting the error like in the image
From your log, it's clear that you haven't configured SDK location
You must add SDK location
sdk.dir=/Users/XXXXX/Library/Android/sdk
Create a new file named local.properties inside the android folder of your react-native app.
Add the SDK location.
Hope this helps

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!

Could not install the app on the device - react native on windows 10

Everytime I try to launch a react native project I got this error
Could not install the app on the device, read the error above for
details. Make sure you have an Android emulator running or a device
connected and have set up your Android development environment
I reinstalled nodejs, python and jdk using choco as suggested on official docs. Every single packages is installed as well as sdk 23.0.1
I can see my virtual device if I run adb devices USB debugging is activated and it's running android 6.
I setup ANDROID_HOME path in environment variables, I'm using same sdk path as you can see in the picture. I also setup another one for JAVA_HOME and Python.
My PATH looks like this:
I just don't understand what I'm supposed to do. I'm using a surface pro 4, Windows 10. I can run projects using expo. I literally tried everything, restart computer, start cmd using admin, create new virtual devices, uninstall everything and start from scratch, it just don't work.
You have pointed out two issues; first, make sure you have an android emulator running. To do that, you run adb devices and you say you can see you device.
The other issue is with the environment. To make sure your environment is setup properly for android, go to the root of your react-native project. Open the android project using android studio.
All errors with your environment will show up, use the automatic fixes provided by android studio. Clean the project in android studio. Close studio and go back to command line, run react-native run-android
Everything should work now.
When doing react-native start it will intentionally hang at "Loading dependency graph" (its not really hanging, its just waiting to receive build/bundle signals). This is correct. You have to open a second terminal then do react-native run-android.
If you get errors, then cd android in your project folder then run ./gradlew clean, then after that do another react-native start then react-native run-android.
Solution is to delete all java JDK and reinstall v8 / change JAVA_HOME to the new path.
Also changing gradle-wrapper.propertiesfile for each project you want to run
# update gradle to latest version
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4.1-all.zip
Sometimes it dosen't compile with v4 so I have to use v3. React native is definitely confusing.
after install dan update environment JDK now I can install app on my device

react-native run-android fails, could not install app

I m having a problem when I try to run my react-native application in my Android Device. The device is connected even when I make sure that it is.
adb devices
List of devices attached
HMNBBCE6A2826109 device
Device: Huawei Y2
Android Version: 5.1
Debug mode: enbaled
the server is running.
When i run
react-native run-android
I get this error
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html
I had the same problem with my linux laptop.
I ran this inside my app root folder and worked:
chmod 755 android/gradlew
You have to give permission on the android/gradlew.
I found the answer on this github issue
And you must also do this:
Click here to see the all article on the react-native docs page (the place where i get this information).
Configure the ANDROID_HOME environment variable
The React Native tools require some environment variables to be set up in order to build apps with native code.
Add the following lines to your $HOME/.bash_profile config file:
export ANDROID_HOME=$HOME/Android/Sdk
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/platform-tools
.bash_profile is specific to bash. If you're using another shell, you will need to edit the appropriate shell-specific config file.
npx #react-native-community/cli doctor
This command checks your environment and displays a report of the status of react-native installation. Check the output carefully for other software you might need to install
I've been struggling with this for a while and in my case (using Windows 10) the solution was to install Java JRE and JDK even though I was already set up with Android Studio.
The problem got clearer when I created a new empty project with create-react-native-app Example and ran it with react-native run-android. The error then complained about JAVA_HOME variable.
Another good tip is to open up your project (located under "android"-folder in your react native project) in Android Studio and see if it compiles.
Good luck!
Try the command.
adb devices
See if there is any devices listed.
If so check the local.properties file inside android folder and check the sdk defined is correct.
if there is no local.properties files. add a new file named local.properties with the following content
## This file is automatically generated by Android Studio.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
#
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
#Thu May 25 18:29:08 IST 2017
sdk.dir=path to sdk
This command will also help
adb reverse tcp:8081 tcp:8081