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

Closed
ToJen opened this issue Jun 30, 2020 · 7 comments
Closed

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

ToJen opened this issue Jun 30, 2020 · 7 comments
Labels
FrozenDueToAge mobile Android, iOS, and x/mobile NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@ToJen
Copy link

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 Android, iOS, and x/mobile label Jun 30, 2020
@gopherbot gopherbot added this to the Unreleased milestone Jun 30, 2020
@dmitshur
Copy link
Contributor

dmitshur commented Jul 1, 2020

/cc @eliasnaur @hyangah @hajimehoshi

@dmitshur dmitshur added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jul 1, 2020
@hajimehoshi
Copy link
Member

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

@ToJen
Copy link
Author

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

@ToJen
Copy link
Author

ToJen commented Aug 6, 2020

thanks @federicobond , will it be reviewed

@gopherbot
Copy link

Change https://golang.org/cl/247357 mentions this issue: env/android-amd64-emu: add ANDROID_SDK_ROOT

gopherbot pushed a commit to golang/build that referenced this issue Aug 14, 2020
ANDROID_HOME is deprecated. golang.org/cl/244057 is replacing it
with ANDROID_SDK_ROOT, and we need the builder to use the new
environment variable. After the change is submitted and gomobile
is updated, we will need another clean up cl to delete ANDROID_HOME.

Updates golang/go#39945

Change-Id: I1f06cead94fbf5cd3c1ca1d8c6c68b2a219898eb
Reviewed-on: https://go-review.googlesource.com/c/build/+/247357
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
@ToJen
Copy link
Author

ToJen commented Sep 23, 2020

Closing due to lack of activity.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge mobile Android, iOS, and x/mobile NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

5 participants