Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android Studio is not being detected.. #32278

Closed
Abdullah-Shamhan opened this issue Sep 27, 2021 · 15 comments
Closed

Android Studio is not being detected.. #32278

Abdullah-Shamhan opened this issue Sep 27, 2021 · 15 comments
Labels

Comments

@Abdullah-Shamhan
Copy link

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..

@sayanarijit
Copy link

Facing the same issue.

➜  ReactNativeApp git:(main) ✗ npx react-native --version
5.0.1
➜  ReactNativeApp git:(main) ✗ which android-studio
/var/lib/snapd/snap/bin/android-studio
➜  ReactNativeApp git:(main) ✗ which sdkmanager
/home/sayanarijit/Android/Sdk/tools/bin/sdkmanager
➜  ReactNativeApp git:(main) ✗ which java
/home/sayanarijit/jdk-11/bin/java

@sayanarijit
Copy link

More info:

System:
    OS: Linux 5.14 Manjaro Linux
    CPU: (8) x64 AMD Ryzen 7 4700U with Radeon Graphics
    Memory: 1.54 GB / 7.15 GB
    Shell: 5.8 - /usr/bin/zsh
  Binaries:
    Node: 16.11.0 - /usr/bin/node
    Yarn: 1.22.15 - ~/.nix-profile/bin/yarn
    npm: 8.0.0 - /usr/bin/npm
    Watchman: Not Found
  SDKs:
    Android SDK:
      API Levels: 30, 31
      Build Tools: 29.0.3, 30.0.2, 31.0.0
      System Images: android-30 | Google Play Intel x86 Atom
      Android NDK: Not Found
  IDEs:
    Android Studio: Not Found
  Languages:
    Java: javac 11 - /home/sayanarijit/jdk-11/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 17.0.1 => 17.0.1
    react-native: 0.64.3 => 0.64.3
  npmGlobalPackages:
    *react-native*: Not Found

@sayanarijit
Copy link

sayanarijit commented Nov 13, 2021

Not sure if it's related, but also see #32043, #28480 and #32110

@sayanarijit
Copy link

sayanarijit commented Nov 13, 2021

So far, I manager to track down the issue to envinfo (a dependency of https://github.com/react-native-community/cli) not being able to get the Android Studio from ANDROID_HOME env var.

➜  ReactNativeApp git:(main) ✗ yarn run envinfo
yarn run v1.22.15
$ /home/sayanarijit/Documents/GitHub/ReactNativeApp/node_modules/.bin/envinfo

   ...
  IDEs:
    Nano: 5.9 - /usr/bin/nano
    VSCode: 1.62.2 - /var/lib/snapd/snap/bin/code
    Vim: 8.2 - /home/sayanarijit/.nix-profile/bin/vim
  ...

@sayanarijit
Copy link

sayanarijit commented Nov 13, 2021

Related issues: react-native-community/cli#858 and tabrindle/envinfo#137

@sayanarijit
Copy link

Found the actual issue. But I'm not sure if it's solvable. Why does react-native need to parse the info so critically? Isn't the binary location all it should need?

@birdofpreyru
Copy link
Contributor

+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.

P.S.: I actually suspect that technically it may live in different locations as well — on my other machine RN environment worked fine with Android Studio installed at $HOME/android-studio, but it is anyway annoying seeing the error in RN doctor and wasting time to just figure out it was all because of the Android Studio location, nobody warned you about.

@cortinico
Copy link
Contributor

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

@zedtux
Copy link
Contributor

zedtux commented Oct 9, 2023

Moving Android Studio to /opt makes doctor green, thank you @sayanarijit!

@farishan
Copy link

Ubuntu 22.04

+1, moving Android Studio to /opt makes doctor green

@alordiel
Copy link

After unzipping the tar file into android-studio and installing the studio I've to move the android-studio folder into /opt/ folder. Only then it all worked.

@birdofpreyru
Copy link
Contributor

birdofpreyru commented Jan 19, 2024

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.

@davincerepo
Copy link

Faced the same problem, the Android SDK is being detected but not the Android Studio. I found the Android Studio is not installed in default path and C:/, and reinstalled in defalut path solved this problem

@naagaraa
Copy link

same problem, in linux. is work if android-studio in /opt folder. in case i installed android studio using snap.

`
npx react-native doctor
Common
✓ Node.js - Required to execute JavaScript code
✓ npm - Required to install NPM dependencies
✓ Metro - Required for bundling the JavaScript code

Android
✓ Adb - Required to verify if the android device is attached correctly
✓ JDK - Required to compile Java code
✖ Android Studio - Required for building and installing your app on Android
✓ ANDROID_HOME - Environment variable that points to your Android SDK installation
✓ Gradlew - Build tool required for Android builds
✓ Android SDK - Required for building and installing your app on Android

Errors: 1
`

this working :

  1. check apps install on snap. "snap list".
  2. go to /snap/android-studio "/snap/bin/android-studio"
  3. check folder again "ls -l"
  4. result like this

`
total 0
drwxr-xr-x 9 root root 246 Mar 1 17:07 150
lrwxrwxrwx 1 root root 3 Mar 17 21:01 current -> 150

`

  1. copy current to dir /opt
  2. "sudo cp -dR /snap/android-studio/current/* /opt/android-studio"
  3. go to dir /opt/android-studio, "cd /opt/android-studio " check that's copy like this

ls bin Install-Linux-tar.txt lib LICENSE.txt NOTICE.txt product-info.json build.txt jbr license meta plugins snap

  1. run again "npx react-native doctor"

`
npx react-native doctor
Common
✓ Node.js - Required to execute JavaScript code
✓ npm - Required to install NPM dependencies
✓ Metro - Required for bundling the JavaScript code

Android
✓ Adb - Required to verify if the android device is attached correctly
✓ JDK - Required to compile Java code
✓ Android Studio - Required for building and installing your app on Android
✓ ANDROID_HOME - Environment variable that points to your Android SDK installation
✓ Gradlew - Build tool required for Android builds
✓ Android SDK - Required for building and installing your app on Android

Errors: 0
Warnings: 0
`

@fetche12345
Copy link

fetche12345 commented Apr 30, 2024

I faced the same issue.
In my case, I've installed Android Studio with Jetbrains Toolbox
To fix it i just created a symlink in /opt pointing to ~/.local/share/JetBrains/Toolbox/apps/android-studio

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

10 participants