SOLVED: HelloWorld example crashes

Supporting 4.1 and up
blainablin
Phidgetsian
Posts: 14
Joined: Tue Oct 09, 2012 7:27 pm
Location: Caledonia, Ontario
Contact:

SOLVED: HelloWorld example crashes

Postby blainablin » Sun Nov 25, 2012 6:46 am

Trying to get the HelloWorld example code to run on a rooted Nextbook Premium 8SE with Android 4.0.3

I run HelloWorld from Eclipse on the Nextbook attached via USB debugging but it crashes immediately.

Here's the logcat. Any help would be appreciated.

Code: Select all

11-25 07:36:09.321: D/dalvikvm(3162): Trying to load lib /data/data/com.example.PhidgetHelloWorld/lib/libphidget21.so 0x41072ed0
11-25 07:36:09.331: D/dalvikvm(3162): Added shared lib /data/data/com.example.PhidgetHelloWorld/lib/libphidget21.so 0x41072ed0
11-25 07:36:09.331: D/dalvikvm(3162): Trying to load lib /data/data/com.example.PhidgetHelloWorld/lib/libphidget21.so 0x41072ed0
11-25 07:36:09.331: D/dalvikvm(3162): Shared lib '/data/data/com.example.PhidgetHelloWorld/lib/libphidget21.so' already loaded in same CL 0x41072ed0
11-25 07:36:09.331: I/dalvikvm(3162): threadid=1: recursive native library load attempt (/data/data/com.example.PhidgetHelloWorld/lib/libphidget21.so)
11-25 07:36:09.341: W/System.err(3162): java.lang.NoSuchFieldError: no field with name='managerPhidget' signature='Z' in class Lcom/phidgets/Phidget;
11-25 07:36:09.341: W/System.err(3162):    at java.lang.Runtime.nativeLoad(Native Method)
11-25 07:36:09.341: W/System.err(3162):    at java.lang.Runtime.loadLibrary(Runtime.java:368)
11-25 07:36:09.351: W/System.err(3162):    at java.lang.System.loadLibrary(System.java:535)
11-25 07:36:09.351: W/System.err(3162):    at com.phidgets.usb.Manager.<clinit>(Manager.java:23)
11-25 07:36:09.351: W/System.err(3162):    at com.example.PhidgetHelloWorld.HelloWorldActivity.onCreate(HelloWorldActivity.java:24)
11-25 07:36:09.351: W/System.err(3162):    at android.app.Activity.performCreate(Activity.java:4465)
11-25 07:36:09.351: W/System.err(3162):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
11-25 07:36:09.351: W/System.err(3162):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
11-25 07:36:09.361: W/System.err(3162):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
11-25 07:36:09.371: W/System.err(3162):    at android.app.ActivityThread.access$600(ActivityThread.java:123)
11-25 07:36:09.371: W/System.err(3162):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
11-25 07:36:09.371: W/System.err(3162):    at android.os.Handler.dispatchMessage(Handler.java:99)
11-25 07:36:09.371: W/System.err(3162):    at android.os.Looper.loop(Looper.java:137)
11-25 07:36:09.371: W/System.err(3162):    at android.app.ActivityThread.main(ActivityThread.java:4424)
11-25 07:36:09.371: W/System.err(3162):    at java.lang.reflect.Method.invokeNative(Native Method)
11-25 07:36:09.371: W/System.err(3162):    at java.lang.reflect.Method.invoke(Method.java:511)
11-25 07:36:09.381: W/System.err(3162):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
11-25 07:36:09.381: W/System.err(3162):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
11-25 07:36:09.381: W/System.err(3162):    at dalvik.system.NativeStart.main(Native Method)
11-25 07:36:09.381: A/libc(3162): Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1)

Last edited by blainablin on Tue Nov 27, 2012 9:14 pm, edited 1 time in total.

User avatar
Patrick
Lead Developer
Posts: 3067
Joined: Mon Jun 20, 2005 8:46 am
Location: Canada
Contact:

Re: HelloWorld example crashes

Postby Patrick » Mon Nov 26, 2012 10:35 am

java.lang.NoSuchFieldError: no field with name='managerPhidget' signature='Z' in class Lcom/phidgets/Phidget;

This means that the phidget21.jar you are using is not from the same library version as the libphidget21.so C library.

-Patrick

blainablin
Phidgetsian
Posts: 14
Joined: Tue Oct 09, 2012 7:27 pm
Location: Caledonia, Ontario
Contact:

Re: HelloWorld example crashes

Postby blainablin » Mon Nov 26, 2012 11:59 am

Patrick wrote:java.lang.NoSuchFieldError: no field with name='managerPhidget' signature='Z' in class Lcom/phidgets/Phidget;

This means that the phidget21.jar you are using is not from the same library version as the libphidget21.so C library.

-Patrick


You'll have to bare with me since I'm a newbie to Eclipse and Android.

To tried to remedy this problem by doing the following:

In Eclipse, I went to the project's Properties > Libraries and removed phidget21.jar and PhidgetsUSB.jar

In Windows Explorer I replaced the libs folder in my project folder with the libs folder from the Android example InterfaceKitUSBExample from the download android-examples_2.1.8.20120912.tar

I then copied the phidget21.jar and PhidgetsUSB.jar file from the same example to the project's libs folder.

I refreshed the project's folder from within Eclipse.

Then I updated the project's Libraries by going to Properties > Libraries > Add JARS and I added both phidget21.jar and PhidgetsUSB.jar from the project's libs folder.

Ran the project on my tablet via USB Debugging and am still getting the crash. New LogCat below. Am I doing something wrong here? I appreciate your help.


Code: Select all

11-26 12:40:43.641: D/dalvikvm(5230): Not late-enabling CheckJNI (already on)
11-26 12:40:43.731: I/dalvikvm(5230): Turning on JNI app bug workarounds for target SDK version 12...
11-26 12:40:43.851: D/dalvikvm(5230): Trying to load lib /data/data/com.example.PhidgetHelloWorld/lib/libphidget21.so 0x4105fa60
11-26 12:40:43.851: D/dalvikvm(5230): Added shared lib /data/data/com.example.PhidgetHelloWorld/lib/libphidget21.so 0x4105fa60
11-26 12:40:43.851: D/dalvikvm(5230): Trying to load lib /data/data/com.example.PhidgetHelloWorld/lib/libphidget21.so 0x4105fa60
11-26 12:40:43.851: D/dalvikvm(5230): Shared lib '/data/data/com.example.PhidgetHelloWorld/lib/libphidget21.so' already loaded in same CL 0x4105fa60
11-26 12:40:43.851: I/dalvikvm(5230): threadid=1: recursive native library load attempt (/data/data/com.example.PhidgetHelloWorld/lib/libphidget21.so)
11-26 12:40:43.851: W/System.err(5230): java.lang.NoSuchFieldError: no field with name='managerPhidget' signature='Z' in class Lcom/phidgets/Phidget;
11-26 12:40:43.871: W/System.err(5230):    at java.lang.Runtime.nativeLoad(Native Method)
11-26 12:40:43.871: W/System.err(5230):    at java.lang.Runtime.loadLibrary(Runtime.java:368)
11-26 12:40:43.871: W/System.err(5230):    at java.lang.System.loadLibrary(System.java:535)
11-26 12:40:43.871: W/System.err(5230):    at com.phidgets.usb.Manager.<clinit>(Manager.java:23)
11-26 12:40:43.871: W/System.err(5230):    at com.example.PhidgetHelloWorld.HelloWorldActivity.onCreate(HelloWorldActivity.java:24)
11-26 12:40:43.871: W/System.err(5230):    at android.app.Activity.performCreate(Activity.java:4465)
11-26 12:40:43.871: W/System.err(5230):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
11-26 12:40:43.871: W/System.err(5230):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
11-26 12:40:43.871: W/System.err(5230):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
11-26 12:40:43.871: W/System.err(5230):    at android.app.ActivityThread.access$600(ActivityThread.java:123)
11-26 12:40:43.871: W/System.err(5230):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
11-26 12:40:43.871: W/System.err(5230):    at android.os.Handler.dispatchMessage(Handler.java:99)
11-26 12:40:43.871: W/System.err(5230):    at android.os.Looper.loop(Looper.java:137)
11-26 12:40:43.871: W/System.err(5230):    at android.app.ActivityThread.main(ActivityThread.java:4424)
11-26 12:40:43.871: W/System.err(5230):    at java.lang.reflect.Method.invokeNative(Native Method)
11-26 12:40:43.871: W/System.err(5230):    at java.lang.reflect.Method.invoke(Method.java:511)
11-26 12:40:43.871: W/System.err(5230):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
11-26 12:40:43.871: W/System.err(5230):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
11-26 12:40:43.871: W/System.err(5230):    at dalvik.system.NativeStart.main(Native Method)
11-26 12:40:43.871: A/libc(5230): Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1)

blainablin
Phidgetsian
Posts: 14
Joined: Tue Oct 09, 2012 7:27 pm
Location: Caledonia, Ontario
Contact:

Re: HelloWorld example crashes

Postby blainablin » Tue Nov 27, 2012 12:16 pm

I've made some progress on this.

I noticed that the libphidget21.so is missing from the libs/armeabi folder in the HelloWorld example download that I got from this thread. Therefore I deleted it from the libs/armeabi folder in my project. I then did a refresh and then a "Clean..." from the Project menu. Then I ran it on my tablet and it worked! Not sure which one of the above fixed it if any of them but it's working now.

Now it doesn't seem to be detecting the phidget being plugged in but I'm going to experiment more with this. Just thought I'd post an update.


Return to “Android”

Who is online

Users browsing this forum: No registered users and 1 guest