Navigation Menu

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
Labels
FrozenDueToAge mobile Android, iOS, and x/mobile
Milestone

Comments

@Torres9
Copy link

Torres9 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 Android, iOS, and x/mobile label Sep 14, 2018
@dmitshur
Copy link
Contributor

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

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

@golang golang locked and limited conversation to collaborators Sep 17, 2019
imWildCat pushed a commit to imWildCat/go-mobile that referenced this issue Apr 10, 2021
Fixes golang/go#27669

Change-Id: Id4071e14fe2a35b2b54801af9d0161f08f3e9e9c
Reviewed-on: https://go-review.googlesource.com/135755
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
imWildCat pushed a commit to imWildCat/go-mobile that referenced this issue Apr 11, 2021
Fixes golang/go#27669

Change-Id: Id4071e14fe2a35b2b54801af9d0161f08f3e9e9c
Reviewed-on: https://go-review.googlesource.com/135755
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
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
Projects
None yet
Development

No branches or pull requests

3 participants