pyjnius icon indicating copy to clipboard operation
pyjnius copied to clipboard

org/kivy/android/PythonActivity java.lang.NoClassDefFoundError

Open jain18aditya opened this issue 3 years ago • 1 comments

Hi I am trying to implement Java in Python using Pyjnius

My code:

            PythonActivity = autoclass('org.kivy.android.PythonActivity')
            currentActivity = cast('android.app.Activity', PythonActivity.mActivity)
            context = cast('android.content.Context', currentActivity.getApplicationContext())

While running i am getting below exception

>           PythonActivity = autoclass('org.kivy.android.PythonActivity')

sarasds/ds_init/DataStoreInit.py:59: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/jnius/reflect.py:229: in autoclass
    c = find_javaclass(clsname)
jnius/jnius_export_func.pxi:26: in jnius.find_javaclass
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   jnius.JavaException: JVM exception occurred: org/kivy/android/PythonActivity java.lang.NoClassDefFoundError

jnius/jnius_jvm_dlopen.pxi:91: JavaException

How to fix this?

jain18aditya avatar Mar 25 '21 19:03 jain18aditya

you are trying to use a android only code in a non android device

takipsizad avatar Mar 09 '22 17:03 takipsizad

I am getting a similar error, i am using android 13.

ArqiesAr avatar Jan 28 '23 04:01 ArqiesAr

Agree with @takipsizad about the log snipped captured by the original author.

@Blackysh , please open a new issue and provide the log snipped captured via adb logcat on your Android 13 device.

misl6 avatar Jan 28 '23 09:01 misl6