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

Running python script on Android but in Docker container #704

Closed
bobmorane83 opened this issue Dec 15, 2023 · 1 comment
Closed

Running python script on Android but in Docker container #704

bobmorane83 opened this issue Dec 15, 2023 · 1 comment
Labels

Comments

@bobmorane83
Copy link

Hi all,

I'am trying to run python script on Android but in Docker container.
So far, I've Docker running OK on my Android 12 board (aarch64).
Running python is ok in container, but I want to access Android framework now.

I've created a container based on openjdk:11, adding Python 3.9, recompiling pyjnius and having this simple code in it:

from jnius import autoclass

DisplayMetrics = autoclass('android.util.DisplayMetrics')
metrics = DisplayMetrics()
print('DPI', metrics.getDeviceDensity())

When I run the container I get the error :

Traceback (most recent call last):
  File "/myapp/app2.py", line 2, in <module>
    DisplayMetrics = autoclass('android.util.DisplayMetrics')
  File "/usr/local/lib/python3.9/dist-packages/pyjnius-1.6.1-py3.9-linux-aarch64.egg/jnius/reflect.py", line 209, in autoclass
    c = find_javaclass(clsname)
  File "jnius/jnius_export_func.pxi", line 22, in jnius.find_javaclass
  File "jnius/jnius_utils.pxi", line 79, in jnius.check_exception
jnius.JavaException: JVM exception occurred: android/util/DisplayMetrics java.lang.NoClassDefFoundError

I have tested also to change JAVA_HOME with Dalvikvm (adding -v /bin:/bin to the docker command)

JAVA_HOME=/bin/dalvikvm

But I got the same error.

BTW, I'am totally new to pyjnius and how this all works. I even don't know if it's possible to do what I want to do !
Any clues/help ?

Thx,
V.

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.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 15, 2023
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