react-native: Android Studio is not being detected..

When I run npx react-native doctor everything seems ok except that it’s not recognizing Android studio

image

I have the latest Android studio arctic fox installed and I have tried to run the project using Android Studio and it was working… but when I run the project using npx react-native run-android It fails because of the Android environment…

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 5
  • Comments: 15 (4 by maintainers)

Most upvoted comments

As said above, Android Studio does not have to be installed into /opt; RN will find it and SDK in different locations as long as you have followed Environment Setup correctly, setting the ANDROID_HOME environment variable, and adding emulator and platform-tools paths to PATH.

The doctor can’t find it wrongly, because, if I recall correctly, it relies on a 3rd party dependency to find software installed on the system, and that 3rd party dependency just looks for Android studio and SDK at the static location in /opt, and does not check environment variables RN actually relies on.

Closing as this issue is with the CLI and should be opened here:

https://github.com/react-native-community/cli/issues

+1. I’ve just bumped into this issue while installing RN dev environment on a new Ubuntu machine. A good solution would be to update RN documentation & RN doctor tool error message to say that Android Studio must be installed into /opt/android-studio.

@birdofpreyru please open a new issue there. Also Android Studio doens’t need to be installed inside /opt. I do have it in another folder and doctor is green for me