Error getting Accelerometer sample from http://pyjnius.readthedocs.org/en/latest/android.html to run

62 views
Skip to first unread message

Meng Choon Tan

unread,
Sep 1, 2014, 12:27:23 AM9/1/14
to pyjni...@googlegroups.com
Hi,

I am new to pyjnius development in Kivy and is hoping if anyone who is familiar with the Accelerometer access  sample code at http://pyjnius.readthedocs.org/en/latest/android.html can assist me with this issue.

I've tried running the sample on an android device but it crashes as soon as the specific accelerometer code loads. 
I followed the instructions to create the "org/myapp/Hardware.java" file and have place the file under the /sdcard/kivy/showcase/.buildozer/android/platform/python-for-android/src folder of the project directory

Here's the error message on logcat.



I/python  (15129):      root.init_android_class('ClassName')

I/python  (15129):    File "/sdcard/kivy/showcase/.buildozer/android/app/main.py", line 279, in init_android_class

I/python  (15129):    File "/sdcard/kivy/showcase/.buildozer/android/platform/python-for-android/dist/myapp/private/lib/python2.7/site-packages/jnius/reflect.py", line 150, in autoclass

I/python  (15129):    File "jnius_export_func.pxi", line 23, in jnius.jnius.find_javaclass (jnius/jnius.c:11687)

I/python  (15129):  jnius.jnius.JavaException: Class not found 'org/myapp/Hardware'

D/InputReader(  839): Input event: value=0 when=8646143735000

I/InputReader(  839): Touch event's action is 0x1 (deviceType=0) [pCnt=1, s=] when=8646143736000

I/InputDispatcher(  839): Delivering touch to: action: 0x1

I/python  (15129): Python for android ended.

W/dalvikvm(15129): threadid=12: thread exiting with uncaught exception (group=0x41715da0)

E/AndroidRuntime(15129): FATAL EXCEPTION: Thread-1898

E/AndroidRuntime(15129): Process: org.test.myapp:python, PID: 15129

E/AndroidRuntime(15129): java.lang.NoClassDefFoundError: org/myapp/Hardware

E/AndroidRuntime(15129): at org.renpy.android.SDLSurfaceView.nativeInit(Native Method)

E/AndroidRuntime(15129): at org.renpy.android.SDLSurfaceView.run(SDLSurfaceView.java:726)

E/AndroidRuntime(15129): at java.lang.Thread.run(Thread.java:841)

E/AndroidRuntime(15129): Caused by: java.lang.ClassNotFoundException: Didn't find class "org.myapp.Hardware" on path: DexPathList[[zip file "/data/app/org.test.myapp-54.apk"],nativeLibraryDirectories=[/data/app-lib/org.test.myapp-54, /vendor/lib, /system/lib]]

E/AndroidRuntime(15129): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:67)

E/AndroidRuntime(15129): at java.lang.ClassLoader.loadClass(ClassLoader.java:497)

E/AndroidRuntime(15129): at java.lang.ClassLoader.loadClass(ClassLoader.java:457)

E/AndroidRuntime(15129): ... 3 more

W/ActivityManager(  839):   Force finishing activity org.test.myapp/org.renpy.android.PythonActivity


Hope that anyone can help to comment if I am doing the steps correctly in getting the sample to work on Android.

Ben Rousch

unread,
Sep 1, 2014, 7:42:32 AM9/1/14
to pyjni...@googlegroups.com

It's a lot easier to use Plyer. It has good accelerometer support.

--
You received this message because you are subscribed to the Google Groups "PyJNIus development ML" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyjnius-dev...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages