-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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: crash in gobind interface call #12020
Comments
CC @crawshaw |
I am without the right kind of device right now, so I won't be able to try this myself until the weekend. |
Please don't override myLib.Events's ref() and call(..) methods, and subclass myLib.Events.Stub. We still need to check why this error causes complete phone crash. |
I couldn't reproduce it from my phone (nexus5, android 5.0.1). |
Hmm that is strange. I compiled into a .arr file on my Linux distribution using Android API 22 and Java 1.7 (Which version did you use?) |
Okay, so I did a little bit of digging (was pretty hard since the trace kept resetting for some reason) I found this following crash report, not sure if it is relevant. 08-05 12:05:18.894 7661-7661/? E/Go﹕ panic: unknown ref 42 |
Thanks, that is a clear error message from inside gobind. Haven't tracked it down yet. |
I couldn't find the same device around me. The 'android' directory is the Android studio project. 'myLib' directory is the go package directory. I am using JDK 1.7. |
There is no difference between the code. |
So I suppose my code crashes as well in your devices. Until we have the same device for reproduction, I think the only option we both can try is emulators. |
Good news! So I went on my Linux environment, did a git clone on your repository, imported it into android studio, compiled the go file into an .arr and added it to the project. A screenshot taken by my phone, running the program. However, if I build the .arr file on my Linux and use it in Android studio on my Windows machine the problem occurs again. |
What is the underlying type of the Events instance once passed to the golang side? When passed to the function |
I just had the same issue in a very similar setting ( Instead of handling the ui element directly in a callback (which leads the the above error), this worked for me: uiElement.post(new Runnable() {
public void run() {
// do stuff with uiElement
}
}); |
@benma, I can take a look at the root cause if you can provide a self-contained case that demonstrates the crash. |
What version of Go are you using (go version)?
go version go1.5beta2 linux/amd64
gomobile version +99196c8 Sat Aug 1 23:05:44 2015 +0000 (android); androidSDK=/usr/local/android-sdk-linux/platforms/android-22
What operating system and processor architecture are you using?
Development: Linux Mint 64bit / Windows 10 64bit on i7 (920)
Phone: Samsung Galaxy note 4 on ARMv7
What did you do?
Created a simple go library:
Compiled a .arr file : gomobile bind {folder path}
Added the .arr file to an Android Studio project.
*Red box indicates which method call that crashes the application, during runtime.
What did you expect to see?
The instance of the object getting appended correctly to the Go slice, or to show a stack trace / error message.
What did you see instead?
Passing null as parameter, shows a null value exception.
However, the example above shuts the application down on my phone completely, with no exception or stack trace, even in debug mode.
Try-catch does not help in this situation.
The text was updated successfully, but these errors were encountered: