-
Notifications
You must be signed in to change notification settings - Fork 1.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
jnius can't find class "org.kivy.android.PythonActivity" with webview #2533
Comments
I was able to reproduce this with the However, if I load it very early in the python app (even if I don't use it), then it works and continues to work later. After reading https://developer.android.com/training/articles/perf-jni#faq_FindClass, my guess is that loading the @foolish-suits if you add a call to |
I think a workaround is to add some One thing that does happen in the SDL code is that it registers the methods from its classes when the library is loaded. A side effect of that is that the Java classes are looked up. We could probably do something similar. I don't know if we have to go all the way to registering the methods, but I think at least adding the |
I think figured out what causes it to break. If you run flask with
This seems to be exactly what's happening. A native thread is being created to handle each request in So, I think there are basically 2 solutions:
For now I'm just going to make a PR that makes flask run non-threaded in the test app since it specifically tries to delay resolving the classes. |
Remove unused function.
Closing as resolved. |
However, I still need to use Multithreading in the Flask,I am trying to use from android.runnable import Runnable
Runnable(main)(*args, **kwargs) But when the request calls the Runnable, the entire app will freeze and unable to perform any operation,Until the Runnableis completed |
Checklist
p4a.branch = develop
)Versions
I followed the build env from the Docker in version v2021.09.05.
Description
I want to use webview as bootstrap and use jnius to access Android API.
I tried the unit test code but build with webview as bootstrap. Build success, running and show the web well, but "vibrate" function failed with 'Didn't find class "org.kivy.android.PythonActivity"'
If I build with SDL2 the vibrate function will work well.
I have tried a lots but no luck, is there any demo or example can work as webview+jnius? Any advice are appreciate.
Thank you!
Command:
Logs
I python : File "jnius/jnius_export_func.pxi", line 26, in jnius.jnius.find_javaclass
I python : File "jnius/jnius_utils.pxi", line 91, in jnius.jnius.check_exception
I python : jnius.jnius.JavaException: JVM exception occurred: Didn't find class "org.kivy.android.PythonActivity" on path: DexPathList[[directory "."],nativeLibraryDirectories=[/system/lib, /vendor/lib, /system/lib, /vendor/lib]] java.lang.ClassNotFoundException
The text was updated successfully, but these errors were encountered: