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

x/mobile: Required use of deprecated environment variables for Android #39945

Open
ToJen opened this issue Jun 30, 2020 · 4 comments
Open

x/mobile: Required use of deprecated environment variables for Android #39945

ToJen opened this issue Jun 30, 2020 · 4 comments

Comments

@ToJen
Copy link

@ToJen ToJen commented Jun 30, 2020

What version of Go are you using (go version)?

$ go version
go version go1.13.10 darwin/amd64

Does this issue reproduce with the latest release?

It should.

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/user/Library/Caches/go-build"
GOENV="/Users/user/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/tomisin.jenrola/go"
GOPRIVATE=""
GOPROXY="https://proxy.server"
GOROOT="/usr/local/Cellar/go@1.13/1.13.10_1/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go@1.13/1.13.10_1/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/path/to/project/go/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/.../go-build183346344=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

I ran gomobile bind -target=android -v github.com/example/package

What did you expect to see?

Output for binding. The use of the _HOME suffix has been deprecated as per this dev doc and this thread. The current suffix is _ROOT.

Temporarily I have this in my ~/.bash_profile:

export ANDROID_SDK_ROOT="$HOME/Library/Android/sdk"
export ANDROID_NDK_ROOT="$ANDROID_SDK_ROOT/ndk/21.3.6528147"

# for gomobile only
export ANDROID_HOME=$ANDROID_SDK_ROOT
export ANDROID_NDK_HOME=$ANDROID_NDK_ROOT

What did you see instead?

Before setting ANDROID_NDK_HOME

gomobile: no Android NDK found in $ANDROID_HOME/ndk-bundle nor in $ANDROID_NDK_HOME

Before setting ANDROID_HOME

gomobile: this command requires ANDROID_HOME environment variable (path to the Android SDK)
@gopherbot gopherbot added the mobile label Jun 30, 2020
@gopherbot gopherbot added this to the Unreleased milestone Jun 30, 2020
@dmitshur
Copy link
Member

@dmitshur dmitshur commented Jul 1, 2020

@hajimehoshi
Copy link
Member

@hajimehoshi hajimehoshi commented Jul 19, 2020

With #35030, I think we should update the environment variables thoroughly.

@ToJen
Copy link
Author

@ToJen ToJen commented Jul 20, 2020

Thanks @hajimehoshi , just to point out that the correct env vars are ANDROID_SDK_ROOT and ANDROID_NDK_ROOT as per the links in the original post.

@federicobond
Copy link

@federicobond federicobond commented Jul 21, 2020

Hi there, I just submitted a fix for this issue in golang/mobile#51, which particularly affects NDKs installed with latest versions of Android Studio. According to the docs here, newer versions of the NDK are no longer installed into $ANDROID_SDK_HOME/ndk-bundle

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

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.