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

Including a JAR on Android #685

Closed
r0x0r opened this issue Oct 16, 2023 · 2 comments
Closed

Including a JAR on Android #685

r0x0r opened this issue Oct 16, 2023 · 2 comments
Labels

Comments

@r0x0r
Copy link

r0x0r commented Oct 16, 2023

Hello
I am author of pywebview and am working on adding Android support based on Kivy/Pyjnius/Buildozer. I have some Java code that needs to be included with the library. It works fine as long as I add a jar via android.add_jars in Buildozer or original Java files via android.add_src in Buildozer. However, since this is a library, I would like to spare the end-user from extra configuration steps and include the library JAR automatically. I have looked into setting a classpath with jnius_config.add_classpath, but I get this error

jnius.jnius.JavaException: JVM exception occurred: Didn't find class "com.pywebview.PyWebViewClient" on path: DexPathList[[zip file "/data/app/~~iFWGkcsFbJM8HyitgPBhcg==/com.pywebview.pywebview-ssFZsxemovo9okhxv_gqKw==/base.apk"],nativeLibraryDirectories=[/data/app/~~iFWGkcsFbJM8HyitgPBhcg==/com.pywebview.pywebview-ssFZsxemovo9okhxv_gqKw==/lib/arm64, /data/app/~~iFWGkcsFbJM8HyitgPBhcg==/com.pywebview.pywebview-ssFZsxemovo9okhxv_gqKw==/base.apk!/lib/arm64-v8a, /system/lib64, /system_ext/lib64]] java.lang.ClassNotFoundException

The code I use is as follows. It is placed before importing jnius and the JAR filepath is correct.

import jnius_config
class_path = os.path.join(os.path.dirname(__file__), '..', 'lib', 'android.jar')
jnius_config.add_classpath('.', class_path)

Any idea what went wrong here? Is this something that can be done via classpath or maybe with the help of a recipe?

@misl6
Copy link
Member

misl6 commented Oct 16, 2023

Hi @r0x0r !

Closing the issue as support, but do not worry, the automation will give you all the details about how to reach us for support and chit-chatting.

@misl6 misl6 added the support label Oct 16, 2023
@github-actions
Copy link

👋 We use the issue tracker exclusively for bug reports and feature requests. However, this issue appears to be a support request. Please use our support channels to get help with the project.
Let us know if this comment was made in error, and we'll be happy to reopen the issue.

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

No branches or pull requests

2 participants