A
A
ajlhimik2020-12-02 21:10:53
Android
ajlhimik, 2020-12-02 21:10:53

Gomobile build failed: exit status 2, why?

I wanted to try how gomobile works and find out what it is in general, since I ask a question, it means that even the example did not work out well!

I am doing this:

C:\Users\user>gomobile build -target=android golang.org/x/mobile/example/basic
gomobile: go build -buildmode=c-shared -o C:\Users\user\AppData\Local\Temp\gomobile-work-535397307\lib\armeabi-v7a\libbasic.so golang.org/x/mobile/example/basic failed: exit status 2
# runtime/cgo
exec: "D:\\_lang\\android\\android": file does not exist


goenv like this:
set GO111MODULE=off
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\user\AppData\Local\go-build
set GOENV=C:\Users\user\AppData\Roaming\go\env
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=D:\_lang\go\gopath
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=D:\_lang\go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=D:\_lang\go\pkg\tool\windows_amd64
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:\Users\user\AppData\Local\Temp\go-build603747754=/tmp/go-build -gno-record-gcc-switches


GO111MODULE was equal to "", but on the github I found a "supposedly fix", it didn't help,

I still don't understand what it is looking for along the path "D:\\_lang\\android\\android"
like this SDK
$ANDROID_HOME = "D:\_lang\android\android sdk"
$ANDROID_NDK_HOME = "D:\_lang\android\android sdk\ndk\22.0.6917172"


Tried bindfrom Android Studio, same thing
D:\_lang\go\gopath\src\golang.org\x\mobile\example\bind\android>gomobile bind -o app/hello.aar -target=android golang.org/x/mobile/example/bind/hello
gomobile: go build -buildmode=c-shared -o=C:\Users\user\AppData\Local\Temp\gomobile-work-070359931\android\src\main\jniLibs\armeabi-v7a\libgojni.so ./gobind failed: exit status 2
# runtime/cgo
exec: "D:\\_lang\\android\\android": file does not exist

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question