0

I'm trying to run this sample project using GraphQL with the Apollo Android client: https://github.com/apollographql/apollo-android/tree/master/apollo-sample

I'm new to Android studio, here's what I did so far:

  1. Installed Android Studio on my machine (mac)
  2. Clone full Apollo Android repo
  3. Started Android studio and opened the apollo-sample directory from the cloned repo as an Android project

I am now getting this build error:

Error:SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.

It's the same issue that's described in this SO question, however none of the solutions of the suggested answer worked for me:

I do have a local.properties file in the root directory of the project that has the sdk.dir set:

sdk.dir=/Users/nburk/Library/Android/sdk

I don't actually know where this entry is coming from, but it's definitely there. I'm assuming it points to the right location, the contents of that path are the following directories:

build-tools
emulator
extras
patcher
platform-tools
platforms
sources
tools

I also tried to set the ANDROID_HOME env var as suggested in the accepted answer but this didn't work either:

nburk
  • 22,409
  • 18
  • 87
  • 132
  • 1
    Setting the variable within the terminal of the IDE doesn't perform an `export` to the environment already determined when you start Android Studio. Try completely closing the process, then adding the variable to `~/.bashrc`, and see if that helps – OneCricketeer Oct 25 '17 at 09:38
  • ah thanks for the hint! now added `ANDROID_HOME` to `.bashrc` and completely closed Android Studio, restarted with new project and still get the same issue – nburk Oct 25 '17 at 09:43
  • 1
    Hmm. Personally, I use IntelliJ instead of Android Studio, and I have used Homebrew to install the SDK. Not sure if those make a huge difference, but the fact that your SDK Manager detects things that are installed, I think you configured it fine – OneCricketeer Oct 25 '17 at 09:48
  • Possible duplicate of [React Native android build failed. SDK location not found](https://stackoverflow.com/questions/32634352/react-native-android-build-failed-sdk-location-not-found) – nightlyop Aug 05 '19 at 15:38
  • Getting same issue, added `ANDROID_HOME` and restarted Android Studio worked for me. – Zerosero Jan 13 '21 at 02:19

1 Answers1

0

Try opening SDK manager in Android studio and see if the SDKlocation is set correctly.

Gowthaman M
  • 8,057
  • 8
  • 35
  • 54
  • yeah. it seems correct. is the android studio placed in Applications? – ashikvashraf Oct 25 '17 at 09:42
  • yes it is there. should the SDK path point to some location inside the application directory? I dont know why it points to `/Users/nburk/Library/Android/sdk` – nburk Oct 25 '17 at 09:44
  • the location is correct for sdk. its the default location of the sdk. Can you check with creating a new project in android studio and try to build that. – ashikvashraf Oct 25 '17 at 09:47
  • 5
    Did you manage to sort this out? If so please share your answer am having same issue but not getting any solution – Polycarp Kavoo Nov 06 '18 at 13:53
  • 1
    Setting the path in Anrdoid Studio and in ANDROID_HOME and PATH variables was not enough for me. I had to create a `local.properties` file. See https://stackoverflow.com/a/32640154/1910855 – nightlyop Aug 05 '19 at 15:37