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: The generated jni function name is mismatched for the go package name having underscore in it #27669

Closed
Torres9 opened this issue Sep 14, 2018 · 2 comments

Comments

Projects
None yet
3 participants
@Torres9
Copy link

commented Sep 14, 2018

Please answer these questions before submitting your issue. Thanks!

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

go version go1.9.2 darwin/amd64
gomobile version +6c7f9ea Thu Sep 13 07:56:01 2018 +0000 (android,ios); androidSDK=

Does this issue reproduce with the latest release?

The gomobile version is the latest

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

GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"

What did you do?

I copied the bind/hello example and tried to bind a go package named go_demo with android app. But once I called the native method greetings, the app crashed. I checked the logcat, here is the reason

No implementation found for java.lang.String go_demo.Go_demo.greetings(java.lang.String) (tried Java_go_1demo_Go_1demo_greetings and Java_go_1demo_Go_1demo_greetings__Ljava_lang_String_2)"

So I opened the libgojni.so library to check the compiled function name, and it's Java_go_1demo_Go_1demo__1init and Java_go_1demo_Go_demo_greetings. So I guess the generated jni function name is wrong for go package name having underscore in it. But the init function is correct.

@gopherbot gopherbot added this to the Unreleased milestone Sep 14, 2018

@gopherbot gopherbot added the mobile label Sep 14, 2018

@dmitshur

This comment has been minimized.

Copy link
Member

commented Sep 17, 2018

Does this issue reproduce with the latest release?

The gomobile version is the latest

That question is referring to the version of Go you have installed. The latest release is Go 1.11. Can you try to see if it's still an issue with it?

It probably won't make a difference because this sounds more related to x/mobile, but it's worth a shot.

/cc @eliasnaur @hyangah

@gopherbot

This comment has been minimized.

Copy link

commented Sep 17, 2018

Change https://golang.org/cl/135755 mentions this issue: bind: fix generated JNI name for Go packages with underscores

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.