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

JavaException: JVM exception occured #60

Closed
brousch opened this issue Apr 26, 2013 · 3 comments
Closed

JavaException: JVM exception occured #60

brousch opened this issue Apr 26, 2013 · 3 comments

Comments

@brousch
Copy link

brousch commented Apr 26, 2013

I get a JVM error while trying to create a Toast. Example code from Kivy Remote:

from jnius import autoclass
AndroidString = autoclass('java.lang.String')
PythonActivity = autoclass('org.renpy.android.PythonActivity')
Toast = autoclass('android.widget.Toast')
msg = AndroidString("Hello, world!".encode('utf-8'))
toast = Toast.makeText(PythonActivity.mActivity, msg, Toast.LENGTH_SHORT)
CHECK FOR org/renpy/android/PythonActivity android/content/Context True
CHECK FOR java/lang/String java/lang/CharSequence True
Traceback (most recent call last):
File "", line 1, in
File "jnius_export_class.pxi", line 751, in jnius.jnius.JavaMultipleMethod.call (jnius/jnius.c:14919)
File "jnius_export_class.pxi", line 508, in jnius.jnius.JavaMethod.call (jnius/jnius.c:12495)
File "jnius_export_class.pxi", line 665, in jnius.jnius.JavaMethod.call_staticmethod (jnius/jnius.c:13745)
File "jnius_utils.pxi", line 40, in jnius.jnius.check_exception (jnius/jnius.c:1855)
JavaException: JVM exception occured

@tito
Copy link
Member

tito commented Jul 2, 2013

I didn't retry, but the JVM exception is... a jvm exception that Pyjnius cannot do anything about it.

You need to check the log, and see what Android tell you about your error. I guess that you cannot make toast outside the ui thread. (ui thread != python thread on android). You might need to use a Runnable object for that.

Have a look at http://python-for-android.readthedocs.org/en/latest/android/#module-android.runnable

@tito tito closed this as completed Jul 2, 2013
@salibeh
Copy link

salibeh commented May 12, 2014

Ben, have you ever solved this issue. Thanks Emil

@brousch
Copy link
Author

brousch commented May 13, 2014

There is an example of using Toasts with Pyjnius at
https://github.com/knappador/kivy-toaster

On Mon, May 12, 2014 at 6:37 AM, Emil Salib notifications@github.comwrote:

Ben, have you ever solved this issue. Thanks Emil


Reply to this email directly or view it on GitHubhttps://github.com//issues/60#issuecomment-42817492
.

Ben Rousch
brousch@gmail.com
http://clusterbleep.net/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants