Error - Go Mobile SDK Applications using Android Studio

I have followed the guide on https://github.com/golang/go/wiki/Mobile using the SDK applications and generating bindings method. Everything seemed fine. I installed go mobile and all the examples. Then, when I imported the $GOPATH/src/golang.org/x/mobile/example/bind/android/hello/build.gradle file like the guide said I got the following error message:

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

In the guide it didn’t mention anything about this. I tried changing the sdk.dir location to where the file was but it didn’t work, it just changed back.

Please help.

How did you do this? What did you change? Where?

You have to configure the variable environment ANDROID_HOME

I opened my project’s local.properties file and changed

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

to

sdk.dir=Users/Adi/Documents/go/src/golang.org/x/mobile/example/bind/hello/hello.go

and saved it, then reloaded my project in Android Studio.

The path of SDK is SDK “/Users/Adi/Library/Android/sdk” path and not your program Go

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.