pyjnius | Access Java classes from Python | Wrapper library

 by   kivy Python Version: 1.6.1 License: MIT

kandi X-RAY | pyjnius Summary

kandi X-RAY | pyjnius Summary

pyjnius is a Python library typically used in Utilities, Wrapper applications. pyjnius has no bugs, it has no vulnerabilities, it has build file available, it has a Permissive License and it has high support. You can install using 'pip install pyjnius' or download it from GitHub, PyPI.

A Python module to access Java classes as Python classes using the Java Native Interface (JNI). Warning: the pypi name is now pyjnius instead of jnius.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              pyjnius has a highly active ecosystem.
              It has 1303 star(s) with 252 fork(s). There are 88 watchers for this library.
              There were 1 major release(s) in the last 6 months.
              There are 140 open issues and 295 have been closed. On average issues are closed in 229 days. There are 3 open pull requests and 0 closed requests.
              OutlinedDot
              It has a negative sentiment in the developer community.
              The latest version of pyjnius is 1.6.1

            kandi-Quality Quality

              pyjnius has 0 bugs and 0 code smells.

            kandi-Security Security

              pyjnius has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              pyjnius code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              pyjnius is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              pyjnius releases are available to install and integrate.
              Deployable package is available in PyPI.
              Build file is available. You can build the component from source.
              Installation instructions are not available. Examples and code snippets are available.
              pyjnius saves you 1505 person hours of effort in developing the same functionality from scratch.
              It has 3660 lines of code, 429 functions and 68 files.
              It has medium code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed pyjnius and discovered the below as its top functions. This is intended to give you an instant insight into pyjnius implemented functionality, and help decide if they suit your requirements.
            • Returns a Java class for the given class name .
            • Try to load the libjjb .
            • Get java .
            • This method is used to log a method .
            • Gets the JDK home .
            • Get the JRE home directory .
            • Get classloader .
            • Compile native invocation handler .
            • Get item at index .
            • Identify a class with a concrete level .
            Get all kandi verified functions for this library.

            pyjnius Key Features

            No Key Features are available at this moment for pyjnius.

            pyjnius Examples and Code Snippets

            Before insall this module,Install python packages,pyJNIus package
            Pythondot img1Lines of Code : 2dot img1License : Strong Copyleft (GPL-3.0)
            copy iconCopy
            #sudo pip install Cython
            #sudo pip install pyjnius
              
            Plyer - a more comprehensive API wrapper
            Pythondot img2Lines of Code : 0dot img2License : Permissive (MIT)
            copy iconCopy
            from plyer.vibrator import vibrate
            vibrate(10)  # in Plyer, the argument is in seconds  
            Pyjnius - raw lowlevel API access
            Pythondot img3Lines of Code : 0dot img3License : Permissive (MIT)
            copy iconCopy
            from jnius import autoclass
            # We need a reference to the Java activity running the current
            # application, this reference is stored automatically by
            # Kivy's PythonActivity bootstrap
            # This one works with SDL2
            PythonActivity = autoclass('org.kivy.andr  
            Kivy app not working while running on samsung
            Pythondot img4Lines of Code : 2dot img4License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            requirements = hostpython3==3.7.8,python3==3.7.8,kivy==1.11.1, certifi,chardet, lxml, docutils, future, idna, Kivy-Garden, Pygments, requests, six, soupsieve, urllib3, deep-translator, arabic-reshaper, python-bidi, openssl, pyopenssl, nump
            AudioRecorder in android using python
            Pythondot img5Lines of Code : 9dot img5License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            from android.permissions import Permission, request_permissions
            def callback_func(permission, results):
              if all([res for res in results):
                print("All permissions granted")
              else:
                print("Did not get all permissions")
            
            request_permi
            Code worked fine, but not the app on kivy
            Pythondot img6Lines of Code : 2dot img6License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            adb logcat|findstr python
            
            Code worked fine, but not the app on kivy
            Pythondot img7Lines of Code : 3dot img7License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            # (list) Permissions
            android.permissions = INTERNET
            
            Kivymd APK App (created with Buildozer) closes after opening up
            Pythondot img8Lines of Code : 3dot img8License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            # comma separated e.g. requirements = sqlite3,kivy
            requirements = python3,kivy==2.0.0,kivymd==0.104.1,pluginname==version
            
            How to view kivy application logs in pc
            Pythondot img9Lines of Code : 2dot img9License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            requirements = kivy==2.0.0,kivymd==0.104.1,python3,pyjnius,plyer,requests,urllib3,chardet,idna,pip,Image,PIL,watchdog
            
            Kivy app on android network issue, Permission denied
            Pythondot img10Lines of Code : 2dot img10License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            android.permissions = INTERNET
            

            Community Discussions

            QUESTION

            Kivymd APK App crashed after installing it in Android phone
            Asked 2022-Jan-31 at 09:12

            I created an APK from Python Kivy & KivyMD, using Google colab. after installing it in my phone (android) , it crashed. there two file in my project main.py, main.json, I have correctly listed Kivy & KivyMD in the requirements in the Buildozer.spec file. (kivy==2.0.0,kivymd==0.104.2) and I add json to included source like this:
            source.include_exts = py,png,jpg,kv,atlas,json

            This is my code..

            main.py: it is a simple Notes app I think that there is no error

            ...

            ANSWER

            Answered 2022-Jan-31 at 09:12

            I have also solved this problem and this helped me. Buildozer requirements is: python3,kivy==2.0.0,kivymd==0.104.2,pillow==8.0.1

            Source https://stackoverflow.com/questions/70914543

            QUESTION

            Kivy app not working while running on samsung
            Asked 2022-Jan-25 at 15:35

            I'm making a kivy app for samsung and compiling it using buildozer, ubuntu on windows.

            This is .spec file:

            ...

            ANSWER

            Answered 2022-Jan-25 at 15:35

            I had same issue in past and I solve by adding every requirements in .spec

            This requirements work for me:

            Source https://stackoverflow.com/questions/70087326

            QUESTION

            Pyjnius looking for libjvm.so in wrong folder - Ubuntu 16.04
            Asked 2022-Jan-10 at 03:05

            I'm somewhat new to Ubuntu (16.04, armhf) and am trying to use pytimeextractor which requires both cython and pyjnius to enable the Java/Python interaction, but am running into the following error with pyjnius:

            SystemError: Error calling dlopen(b'/usr/lib/jvm/jdk1.8.0-openjdk-armhf/jre/lib/arm/server/libjvm.so': b'/usr/lib/jvm/jdk1.8.0-openjdk-armhf/jre/lib/arm/server/libjvm.so: cannot open shared object file: No such file or directory'

            I was initially having issues with setting JAVA_HOME (getting a KeyError), which lead me to purge existing Java installations such as the folder referenced in the SystemError above: "*/jdk1.8.0-openjdk-armhf/..."

            After reinstalling Java and setting JAVA_HOME in etc/environment, then uninstalling and reinstalling pyjnius, it is still pointing to this old, now non-existent Java installation... rather than the JAVA_HOME now set (/usr/lib/jvm/java-1.8.0-openjdk-armhf) and I have not the slightest idea why.

            Could someone please help point me in the right direction of resolving this issue? I feel out of my depth with the extent of Ubuntu knowledge required to accurately diagnose the errors in front of me and swiftly resolve them. Thank you.

            ...

            ANSWER

            Answered 2022-Jan-10 at 03:05

            I have managed to resolve this issue. As far as I can tell, I had set the JAVA_HOME to point at the correct installation of Java but needed to log out and back in for the changes to take effect.

            Source https://stackoverflow.com/questions/70646863

            QUESTION

            Code worked fine, but not the app on kivy
            Asked 2021-Oct-23 at 13:42

            I am trying to create a kivy app for android device. And my code is working great on the PC. But the apk file created using buildozer is not really working on the android. It crashes before opening. But a simple Hello World Example works perfect With the same spec file.. I am not at all using any external modules in the app. Only socket module (which is a python core module.)

            I don't know, what is happening. So I used socket to create a functionality to try the code and in exception I have given the code to send the Exception to my IP. Also I am having a program ready to receive and print the signal. Both these things worked great on the PC. But apk still crashes. Without sending any logs to my PC.

            Here is the spec file:

            ...

            ANSWER

            Answered 2021-Oct-21 at 04:06

            Remove comment from android.permissions = INTERNET,
            then it may work.

            Source https://stackoverflow.com/questions/69650829

            QUESTION

            Kivymd APK App (created with Buildozer) closes after opening up
            Asked 2021-Oct-16 at 12:52

            I have created an APK file from Python Kivy & KivyMD, using Buildozer. When I open the app after installing it, it shows the splash image and then closes. I have checked and found that their seems no issue in the main.py, as I have correctly listed Kivy & KivyMD in the requirements in the Buildozer.spec file. (kivy==2.0.0,kivymd==0.104.1)

            This is my code..

            main.py

            ...

            ANSWER

            Answered 2021-Oct-16 at 08:18

            If you have some other plugins just add them like this:

            Source https://stackoverflow.com/questions/69593107

            QUESTION

            why are not showing after app in android?
            Asked 2021-Sep-27 at 11:28

            from kivy.uix.screenmanager import Screen from plyer import call from plyer.platforms.android import activity from kivy.utils import platform import os

            ...

            ANSWER

            Answered 2021-Aug-25 at 14:54

            plyer call method works only on android and iOS as descripted here here

            Source https://stackoverflow.com/questions/68924221

            QUESTION

            Kivy app on android network issue, Permission denied
            Asked 2021-Sep-23 at 18:46

            I'm trying to make kivy app for android that has some simple network features. The app works fine on pc but when I try to import it to android it doesn't work anymore. At first my app crashed on startup which was apparently caused by having network stuff on my main thread so I moved all the network stuff to another thread so my app doesn't crash anymore but it doesn't work either. Here is where I make new thread for networking:

            ...

            ANSWER

            Answered 2021-Aug-12 at 12:25

            You don't need android.permissions in your requirements, but you will need the line:

            Source https://stackoverflow.com/questions/68753183

            QUESTION

            Kivy/KivyMD application crashes on Android after compiling to .apk
            Asked 2021-Aug-13 at 09:58

            I'm a newbie at Python and Kivy as well, so please help me.

            So I wanted to compile my app to .apk and found a guide video on YouTube.(I'm using Windows btw)

            Here it is - https://www.youtube.com/watch?v=D0reWInYl6k&ab_channel=SBDeveloper

            So, when I was editing buildozer.spec I noticed that author didn't set the latest KivyMD version, so I did.

            And it compiled succesfully, but when I opened it on my phone, it showed the kivy loading screen and then just crashed.

            I searched a lot what is the problem but didn't understand anything.

            Here is buildozer.spec file:

            ...

            ANSWER

            Answered 2021-Aug-13 at 09:58

            Short version: buildozer -v android debug deploy run logcat to know what is the problem.

            _

            Long version:

            After having done a lot of kivy app I can give the best advice you will ever have: do "Hello World" (which means do the tiniest possible working code). Actually, without error message and that much possibility of crashing without all the information your title is not Kivy/KivyMD application crashes on Android after compiling to .apk but HELP ME which is time consuming...

            Problems:

            • Trying to import that much stuff without having a working MVP app is madness.
            • You are importing MD stuff which evolve quickly and can easely work on a version and crash on another.
            • You are using storage without asking it on the buildozer.
            • You don't show your python code even if you are actually crashing on the build/on_kv_post.
            • You need to use buildozer -v android debug deploy run logcat to get visual on your errors by connecting your phone to your PC.

            If you had done step by step, you would have pass from Kivy/KivyMD application crashes on Android after compiling to .apk to something like: Why does the MDWidgetXXX is not working on Android or Kivy: How to register file on Android

            Source https://stackoverflow.com/questions/68761755

            QUESTION

            Buildozer Class not found b'org/renpy/android/PythonActivity'
            Asked 2021-Jul-28 at 22:52

            After compiling a Kivy Application with Buildozer, it crashes on Android when run

            Example:

            ...

            ANSWER

            Answered 2021-Jul-28 at 22:52

            In order for everything to work correctly and the example below to run, you need to perform the following steps:

            On your PC:

            Source https://stackoverflow.com/questions/68513776

            QUESTION

            Buildozer built app crashes after showing the presplash screen
            Asked 2021-Jul-20 at 05:02

            I am new to kivy and it's my first build with the kivy, I used google collab for the compilation environment ,Error is very time open my app it loads and shows pre splash screen and then it crashes, I have also tried adb for getting logs but it doesn't give any info, here is the link to the apk

            here is my app code

            ...

            ANSWER

            Answered 2021-Jul-15 at 12:56

            I have a tip for using the log.txt , instead of this , you can use real-time logs and it filters only python log here is the command..

            It can be hard to look for errors in log.txt , best method is to search for these keyword. No Module, No NameError , Traceback , indentation error

            Command to filter python logs while deployin on device

            buildozer android deploy run logcat | grep python

            Source https://stackoverflow.com/questions/68357080

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install pyjnius

            You can install using 'pip install pyjnius' or download it from GitHub, PyPI.
            You can use pyjnius like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.

            Support

            Make sure a Java Development Kit (JDK) is installed on your operating system if you want to use PyJNIus on desktop. OpenJDK is known to work, and the Oracle Java JDK should work as well. On windows, make sure JAVA_HOME points to your java installation, so PyJNIus can locate the jvm.dll file allowing it to start java. This shouldn’t be necessary on OSX and Linux, but in case PyJNIus fails to find it, setting JAVA_HOME should help.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            Install
          • PyPI

            pip install pyjnius

          • CLONE
          • HTTPS

            https://github.com/kivy/pyjnius.git

          • CLI

            gh repo clone kivy/pyjnius

          • sshUrl

            git@github.com:kivy/pyjnius.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Consider Popular Wrapper Libraries

            jna

            by java-native-access

            node-serialport

            by serialport

            lunchy

            by eddiezane

            ReLinker

            by KeepSafe

            pyserial

            by pyserial

            Try Top Libraries by kivy

            kivy

            by kivyPython

            python-for-android

            by kivyPython

            buildozer

            by kivyPython

            plyer

            by kivyPython

            kivy-designer

            by kivyPython