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/app: Open(.) behavior in Java Activity #9422

Closed
jhleath opened this issue Dec 22, 2014 · 4 comments
Closed

x/mobile/app: Open(.) behavior in Java Activity #9422

jhleath opened this issue Dec 22, 2014 · 4 comments
Assignees

Comments

@jhleath
Copy link

@jhleath jhleath commented Dec 22, 2014

  1. Using the latest committed version of golang.org/x/mobile (just go get -u'd it), and a devel version of Go.
  2. Compiling on darwin/amd64 for android/arm.
  3. I was attempting to utilize golang.org/x/mobile/app.Open() in an net/http server response.
  4. I expected to get an open reference to the file or an error detailing why the file could not be opened.
  5. Instead, I get the following "interesting" error in logcat.

Logs:

I/GoStdio (18461): GET /Index.html on app.melange.127.0.0.1.xip.io:7776 app
I/GoStdio (18461): Opening file client /Index.html
I/GoStdio (18461): About to App.Open
I/WindowState(  530): WIN DEATH: Window{1d53fd00 u0 com.getmelange.melange/com.getmelange.melange.MainActivity}
E/libprocessgroup(  530): failed to kill 1 processes for processgroup 18461
I/ActivityManager(  530): Process com.getmelange.melange (pid 18461) has died
W/ActivityManager(  530): Force removing ActivityRecord{2f5aeb91 u0 com.getmelange.melange/.MainActivity t279}: app died, no saved state
I/ActivityManager(  530): Activity reported stop, but no longer stopping: ActivityRecord{71ab226 u0 com.android.launcher/com.android.launcher2.Launcher t27}

Searching around suggests that WIN DEATH is caused when the application stops responding. Through effective fmt.Println() debugging, I was able to determine that app.Open() does not return, but the WIN DEATH error is always triggered.

Note that I'm running the application on a Nexus 7 running Lollipop.

@jhleath
Copy link
Author

@jhleath jhleath commented Dec 22, 2014

After rebuilding the Docker image, updating the mobile repo, and recompiling, I have found a new error message that may have something interesting log message.

I/GoStdio (18461): About to App.Open
E/JavaBinder(  530): !!! FAILED BINDER TRANSACTION !!!
I/WindowState(  530): WIN DEATH: Window{1d53fd00 u0 com.getmelange.melange/com.getmelange.melange.MainActivity}

I'm not entirely sure why the binder is getting involved in the app.Open(), but that seems to be the root of the issue. I will keep investigating.

@jhleath
Copy link
Author

@jhleath jhleath commented Dec 23, 2014

I have isolated the problem. It appears when calling Go code from within an activity that is not a NativeActivity. Since onCreate is only called within android.go when utilizing a NativeActivity, the assetManager variable is not set.

I'm going to create a patch for my needs, but I'm not sure if this is something that is expected to be supported in general (calling app.Open(.) if you are not using a fully-native activity). Any thoughts?

@jhleath jhleath changed the title mobile: app.Open(.) behavior in non-main Goroutine mobile: app.Open(.) behavior in Java Activity Dec 23, 2014
@crawshaw crawshaw self-assigned this Dec 23, 2014
@crawshaw
Copy link
Contributor

@crawshaw crawshaw commented Dec 23, 2014

This should work, so it's a bug. If you intend to send a CL please let me know, otherwise I'll take a look.

@jhleath
Copy link
Author

@jhleath jhleath commented Dec 23, 2014

I don't expect to send a CL because of my limited knowledge of the JNI, so I would certainly appreciate you taking a look at it. Thanks!

@hyangah hyangah added the repo-mobile label Dec 31, 2014
@mikioh mikioh changed the title mobile: app.Open(.) behavior in Java Activity app: Open(.) behavior in Java Activity Jan 4, 2015
@mikioh mikioh changed the title app: Open(.) behavior in Java Activity x/mobile/app: Open(.) behavior in Java Activity Aug 5, 2015
@golang golang locked and limited conversation to collaborators Aug 5, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.