Closed nikolay-turpitko closed 6 years ago
/cc @crawshaw
I am currently getting the same error. After some digging, I found that the gobind command cannot resolve the imports in the go files when GOOS is set to "android". This can be easily determined adding some output to the error handler function here:
https://github.com/golang/mobile/blob/master/cmd/gobind/main.go#L110
Looking further, it seems that both the gobind and the gomobile command make use of the "go/importer" package, but gomobile creates a fake GOPATH so that the imports can be resolved, gobind however does not.
https://github.com/golang/mobile/blob/master/cmd/gomobile/bind.go#L684
This is strange though, since it apparently works for others, so I'm stumped at this point. Does anyone have any ideas?
I'm getting the same issue, with go1.9 linux/amd64
. Code and output:
https://github.com/syncthing/syncthing-android/pull/959 https://gist.github.com/Nutomic/4fd51a707886f1b01ac5ca4eff68de95
Btw #21319 is about the same issue, but claims that it was fixed with go 1.9 (which I am using).
It works for me with ./gradlew installDebug
from the reverse directory. Do you have the latest checkout of golang.org/x/mobile and have run go install golang.org/x/mobile/cmd/... recently?
Change https://golang.org/cl/101155 mentions this issue: example/reverse: delete
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go version go1.7.3 linux/amd64
java -version openjdk version "1.8.0_111" OpenJDK Runtime Environment (build 1.8.0_111-8u111-b14-2ubuntu0.16.04.2-b14) OpenJDK 64-Bit Server VM (build 25.111-b14, mixed mode)
What operating system and processor architecture are you using (
go env
)?GOARCH="amd64" GOBIN="" GOEXE="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOOS="linux" GOPATH="/home/nick/go" GORACE="" GOROOT="/home/nick/.local/share/umake/go/go-lang" GOTOOLDIR="/home/nick/.local/share/umake/go/go-lang/pkg/tool/linux_amd64" CC="gcc" GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build237209226=/tmp/go-build -gno-record-gcc-switches" CXX="g++" CGO_ENABLED="1
What did you do?
If possible, provide a recipe for reproducing the error. A complete runnable program is good. A link on play.golang.org is best.
First of all, build of
golang.org/x/mobile/example/basic
works for me on both phone and PC.What did you expect to see?
Successful build
What did you see instead?