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: gomobile bind golang.org/x/mobile/example/reverse/reverse
fails on macOS
#17945
Comments
gomobile bind golang.org/x/mobile/example/reverse/reverse
fails on macOSgomobile bind golang.org/x/mobile/example/reverse/reverse
fails on macOS
The situation has changed a little: the current error message is
Is this expected? |
That's expected, you can't directly gomobile bind the reverse package since it depends on Java classes defined by the gradle build. Go to example/reverse/android and run gradlew installDebug from there instead. |
Thank you. I've succeeded BTW, can I request a feature to make it enable to gomobile-bind this without gradle? |
You can do so already, by replicating what the gobind gradle plugin does. For simple cases, adding -classpath to gomobile will be enough. For the hard cases where Go code references Java code that itself references Go types, the the gobind tool is used to generate the Java classes for exported Go types and functions, breaking the reference cycle. |
Thanks, but I still don't understand what path should be specified for classpath. |
the gomobile bind takes a -classpath argument that should point to the
class path with (in your case) the support library.
Den tir. 7. feb. 2017 17.28 skrev Hajime Hoshi <notifications@github.com>:
… Thanks, but I still don't understand what path should be specified for
classpath. What did you mean "classpath to gomobile"?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#17945 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAgCDHEQDeOex89hs8wc9Y_Xm3xGCv09ks5raJuqgaJpZM4K0NB3>
.
|
I've managed to build the import (
"Java/android/databinding/DataBindingUtil"
"Java/android/os"
"Java/android/support/v7/app"
gopkg "Java/reverse"
rlayout "Java/reverse/R/layout"
"Java/reverse/databinding"
"Java/reverse/databinding/ActivityMainBinding"
"Java/java/lang/Float"
"Java/java/lang"
) then use it somewhere: type MainActivity struct {
app.AppCompatActivity
binding databinding.ActivityMainBinding
f lang.Float
} and run
|
I've mailed https://go-review.googlesource.com/38635 that should fix your case. |
CL https://golang.org/cl/38635 mentions this issue. |
Before this CL, unexported fields were ignored for the purposes of determining which classes a Go struct should extend or implement. However, the field types were also ignored, resulting in the types not being generated at all. This CL adds the types of unexported fields to the set of types to be generated. Fixes golang/go#17945 Change-Id: I5c6c44b7cdfe0c3d4c4dc44863ae201dca7ae9a4 Reviewed-on: https://go-review.googlesource.com/38635 Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Before this CL, unexported fields were ignored for the purposes of determining which classes a Go struct should extend or implement. However, the field types were also ignored, resulting in the types not being generated at all. This CL adds the types of unexported fields to the set of types to be generated. Fixes golang/go#17945 Change-Id: I5c6c44b7cdfe0c3d4c4dc44863ae201dca7ae9a4 Reviewed-on: https://go-review.googlesource.com/38635 Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
What version of Go are you using (
go version
)?What operating system and processor architecture are you using (
go env
)?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.
What did you expect to see?
Successfully build.
What did you see instead?
Build error (packages beginning with
Java
are not found).The text was updated successfully, but these errors were encountered: