expo-cli icon indicating copy to clipboard operation
expo-cli copied to clipboard

ANDROID_HOME on linux

Open bearkfear opened this issue 1 year ago • 2 comments

Summary

I`m running an project with expo on linux (Zorin OS). When i try to run the app the expo is saying "Failed to resolve the Android SDK path. Default install location not found: /home/enrico/Android/sdk. Use ANDROID_HOME to set the Android SDK location."

The problems and fix

  • Android home
    • Problem: Failed to resolve the Android SDK path. Default install location not found: ~/Android/sdk. Use ANDROID_HOME to set the Android SDK location.
    • Solution: The default ANDROID_HOME in linux is $HOME/Android/Sdk and the platform tools is PATH=$PATH:$ANDROID_HOME/platform-tools

Environment

  expo-env-info 1.0.5 environment info:
    System:
      OS: Linux 5.15 Zorin OS 16.1
      Shell: 5.8 - /usr/bin/zsh
    Binaries:
      Node: 16.15.1 - ~/.asdf/installs/nodejs/16.15.1/bin/node
      Yarn: 1.22.19 - ~/.asdf/installs/nodejs/16.15.1/.npm/bin/yarn
      npm: 8.18.0 - ~/work/MBPharma/node_modules/.bin/npm
    npmPackages:
      @expo/webpack-config: ^0.17.0 => 0.17.2 
      expo: ~46.0.7 => 46.0.8 
      react: 18.0.0 => 18.0.0 
      react-dom: 18.0.0 => 18.0.0 
      react-native: 0.69.5 => 0.69.5 
      react-native-web: ~0.18.7 => 0.18.7 
    npmGlobalPackages:
      eas-cli: 1.2.0
      expo-cli: 6.0.5
    Expo Workflow: managed

Please specify your device/emulator/simulator platform, model and version

PIXEL_2 emulator SDK 30

Error output

No response

Reproducible demo or steps to reproduce from a blank project

Run an project in linux using expo with

yarn start

then if successfully runs start android studio and start an android emulator like pixel. Then if all runs fine press a to open in Android emulator

bearkfear avatar Aug 31 '22 00:08 bearkfear

I'm also seeing this when running from within Docker on Windows. Not having this problem on Docker on macOS.

bbuchalter avatar Sep 07 '22 01:09 bbuchalter

Having a very similar issue:

when running the client with npx expo start everything works as expected.

when running the client with tunnel support I get an error message:

npx expo start --tunnel

Starting project at /SOME/PATH
Starting Metro Bundler
Failed to resolve the Android SDK path. Default install location not found: /home/NAME/Android/sdk. Use ANDROID_HOME to set the Android SDK location.
Failed to resolve the Android SDK path. Default install location not found: /home/NAME/Android/sdk. Use ANDROID_HOME to set the Android SDK location.
Error: spawn adb ENOENT
Error: spawn adb ENOENT
    at Process.ChildProcess._handle.onexit (node:internal/child_process:283:19)
    at onErrorNT (node:internal/child_process:478:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)"

My environment:

lsb_release -a

Distributor ID: Ubuntu
Description:    Ubuntu 20.04.5 LTS
Release:        20.04


npm list

source@ /SOME/PATH
├── @expo/[email protected]
├── [email protected]
.....

Chr1k0 avatar Sep 15 '22 10:09 Chr1k0

any solution ?

heithemkacem avatar Sep 23 '22 11:09 heithemkacem

diable your firewall sudo ufw disable

Rajat-Raghuvanshi-0512 avatar Sep 23 '22 21:09 Rajat-Raghuvanshi-0512

The same here!

JuanDSG avatar Oct 03 '22 18:10 JuanDSG

Please expo team, is this issues getting fixed ? It's slowing down a lot of process

FrancoRATOVOSON avatar Oct 15 '22 15:10 FrancoRATOVOSON

I have the same issue as @Chr1k0 Distributor ID: Debian Description: Debian GNU/Linux 11 (bullseye) Release: 11 Codename: bullseye @Rajat-Raghuvanshi-0512 ufw is not a command in my environment. Any other ideas how to fix this?

Stewartarmbrecht avatar Oct 16 '22 17:10 Stewartarmbrecht

This issue started for me when we upgraded from Expo 44 to 46. For me the solution was that the folder was named "Sdk" with a capital "S" but the error message said the folder with a lowercase "s" didn't exist. So I changed the name to "sdk" instead of "Sdk" and it worked.

Brushan avatar Oct 18 '22 14:10 Brushan

Had the same issue: ANDROID_HOME is set to a non-existing path

I had to set the environment variables by adding the correct path (Linux Mint) edit the .bashrc file using nano or gedit or whatever it is you use and add the following paths to that file

export ANDROID_HOME=${HOME}/Android/Sdk export PATH=${ANDROID_HOME}/tools:${PATH} export PATH=${ANDROID_HOME}/emulator:${PATH} export PATH=${ANDROID_HOME}/platform-tools:${PATH}

then

source .bashrc

worked for me

Programmer- avatar Oct 22 '22 22:10 Programmer-

Wow brushan, can't believe that was the problem. that helped me, thanks.

cdialpha avatar Oct 28 '22 20:10 cdialpha

Same happening here on OSX.

RSchneider94 avatar Oct 28 '22 23:10 RSchneider94

I have the issue, but I try had fixed. That is my solution Follow this step first: https://stackoverflow.com/questions/38577669/run-react-native-on-android-emulator And then config Add the following lines to your $HOME/.bash_profile or $HOME/.bashrc (if you are using zsh then ~/.zprofile or ~/.zshrc) config file:

export ANDROID_SDK_ROOT=$HOME/Library/Android/Sdk export PATH=$PATH:$ANDROID_SDK_ROOT/emulator export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools

Reload bash or zsh editor Reset

It works for me.

DoVuDung avatar Nov 05 '22 09:11 DoVuDung

Two things:

  1. In versioned Expo CLI we no longer ship a vendored copy of adb, users are required to install and configure Android support for their computer. The vendored copy had a lot of issues since expo-cli shipped a copy for every supported OS of expo-cli. This also caused a ton of bloat on devices since every project would have multiple copies of adb.

  2. I landed a fix for the versioned CLI requiring adb for tunnel connections: https://github.com/expo/expo/pull/19593. You can now use all platform agnostic features of the versioned CLI without having to install any Android-specific libraries.

EvanBacon avatar Nov 05 '22 16:11 EvanBacon