Amarino based apps crashing

202 views
Skip to first unread message

durn

unread,
Sep 23, 2010, 10:40:55 AM9/23/10
to Amarino Toolkit
I recently installed Amarino on an HTC Dream running Cyanogen android
2.2. The Armino app runs great, connects to my arduino board and I
can send and receive data from the app. However, I am unable to run
SensorGraph, MultiColorLamp or my own code using Amarino. Whenever
they make the Amarino.connect call the app just crashes. Has anyone
seen this problem or have any suggestions? Thank you.

Bonifaz

unread,
Sep 23, 2010, 11:24:43 AM9/23/10
to Amarino Toolkit
Amarino must be installed on your phone and the device you want to
connect to must be in Amarino's device list (it must not be connected
though) in order to be able to use the AmarinoLibrary
(Amarino.connect(...) etc.) in your own apps or the SensorGraph,
MultiColorLamp app.

durn

unread,
Sep 23, 2010, 11:39:06 AM9/23/10
to Amarino Toolkit
I have Amarino installed and the device added to the device list (but
not connected). When I start SensorGraph I just get:

Sorry! The application SensorGraph
(process.edu.mit.mediat.hlt.sensorgraph) has stopped unexpectedly.
Please try again. I would expect that even if it couldn't connect to
the device that the entire application wouldn't crash. I have tried
this on 2 HTC Dreams running both android 2.1 and android 2.2 with the
same result. Do I actually need to start Amarino or is there a
background service running all the time? Would it be possible for you
to compile me an apk of sensorgraph and send it to me to install to
see if the problem is in my compilation. the address for the
bluetooth device is 00:07:80:88:00:BC and I would prefer it compiled
for android 2.2. Thanks in advance for your help.

Bonifaz

unread,
Sep 23, 2010, 11:52:52 AM9/23/10
to Amarino Toolkit
I recommend to install the Android SDK and use the DDMS tool to figure
out why it crashes.
Once you start DDMS (in the tools directory of the Android SDK) you
will see the log of your phone and a complete stack trace.
I am certain it is only a minor thing you overlook.

The SensorGraph example is pretty straight forward and there are not
many things taht can go wrong.
You don't need to connect with Amarino, only the device must be added.
The SensorGraph Amarino.connect(...) method will take care of
connecting to it.

Make also sure that you have the latest version of Amarino and
AmarionLibrary.jar.

durn

unread,
Sep 23, 2010, 11:55:29 AM9/23/10
to Amarino Toolkit
I will try out DDMS. I should have the latest version Amarino and
AmarinoLibrary.jar. I downloaded them from the google code Amarino
site this morning. Thanks.


durn

unread,
Sep 23, 2010, 12:50:18 PM9/23/10
to Amarino Toolkit
See the ddms log for sensor graph. It appears that it is unable to
find a the Amarino Library on the phone. This may be due to the way I
compiled. I put the Amarino Library jar (downloaded from the Amarino
website) in a convenient location and then compiled as follows:

ant debug -lib <path_to_amarinolib.jar>

09-23 10:38:27.863: DEBUG/dalvikvm(1319): GC freed 9632 objects /
446016 bytes in 105ms
09-23 10:38:28.463: INFO/ActivityManager(123): Starting activity:
Intent { act=android.intent.action.MAIN
cat=[android.intent.category.LAUNCHER] flg=0x10200000
cmp=edu.mit.media.hlt.sensorgraph/.SensorGraph }
09-23 10:38:28.623: INFO/ActivityManager(123): Start proc
edu.mit.media.hlt.sensorgraph for activity
edu.mit.media.hlt.sensorgraph/.SensorGraph: pid=1435 uid=10038 gids={}
09-23 10:38:28.713: DEBUG/ddm-heap(1435): Got feature list request
09-23 10:38:28.893: INFO/dalvikvm(1435): Could not find method
at.abraxas.amarino.Amarino.connect, referenced from method
edu.mit.media.hlt.sensorgraph.SensorGraph.onStart
09-23 10:38:28.893: WARN/dalvikvm(1435): VFY: unable to resolve static
method 22: Lat/abraxas/amarino/Amarino;.connect (Landroid/content/
Context;Ljava/lang/String;)V
09-23 10:38:28.893: DEBUG/dalvikvm(1435): VFY: replacing opcode 0x71
at 0x0011
09-23 10:38:28.893: DEBUG/dalvikvm(1435): Making a copy of Ledu/mit/
media/hlt/sensorgraph/SensorGraph;.onStart code (60 bytes)
09-23 10:38:28.903: INFO/dalvikvm(1435): Could not find method
at.abraxas.amarino.Amarino.disconnect, referenced from method
edu.mit.media.hlt.sensorgraph.SensorGraph.onStop
09-23 10:38:28.903: WARN/dalvikvm(1435): VFY: unable to resolve static
method 23: Lat/abraxas/amarino/Amarino;.disconnect (Landroid/content/
Context;Ljava/lang/String;)V
09-23 10:38:28.903: DEBUG/dalvikvm(1435): VFY: replacing opcode 0x71
at 0x0005
09-23 10:38:28.903: DEBUG/dalvikvm(1435): Making a copy of Ledu/mit/
media/hlt/sensorgraph/SensorGraph;.onStop code (44 bytes)
09-23 10:38:29.013: DEBUG/AndroidRuntime(1435): Shutting down VM
09-23 10:38:29.013: WARN/dalvikvm(1435): threadid=3: thread exiting
with uncaught exception (group=0x4001e178)
09-23 10:38:29.023: ERROR/AndroidRuntime(1435): Uncaught handler:
thread main exiting due to uncaught exception
09-23 10:38:29.043: ERROR/AndroidRuntime(1435):
java.lang.NoClassDefFoundError: at.abraxas.amarino.Amarino
09-23 10:38:29.043: ERROR/AndroidRuntime(1435): at
edu.mit.media.hlt.sensorgraph.SensorGraph.onStart(SensorGraph.java:73)
09-23 10:38:29.043: ERROR/AndroidRuntime(1435): at
android.app.Instrumentation.callActivityOnStart(Instrumentation.java:
1129)
09-23 10:38:29.043: ERROR/AndroidRuntime(1435): at
android.app.Activity.performStart(Activity.java:3723)
09-23 10:38:29.043: ERROR/AndroidRuntime(1435): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
2468)
09-23 10:38:29.043: ERROR/AndroidRuntime(1435): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:
2512)
09-23 10:38:29.043: ERROR/AndroidRuntime(1435): at
android.app.ActivityThread.access$2200(ActivityThread.java:119)
09-23 10:38:29.043: ERROR/AndroidRuntime(1435): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
09-23 10:38:29.043: ERROR/AndroidRuntime(1435): at
android.os.Handler.dispatchMessage(Handler.java:99)
09-23 10:38:29.043: ERROR/AndroidRuntime(1435): at
android.os.Looper.loop(Looper.java:123)
09-23 10:38:29.043: ERROR/AndroidRuntime(1435): at
android.app.ActivityThread.main(ActivityThread.java:4363)
09-23 10:38:29.043: ERROR/AndroidRuntime(1435): at
java.lang.reflect.Method.invokeNative(Native Method)
09-23 10:38:29.043: ERROR/AndroidRuntime(1435): at
java.lang.reflect.Method.invoke(Method.java:521)
09-23 10:38:29.043: ERROR/AndroidRuntime(1435): at
com.android.internal.os.ZygoteInit
$MethodAndArgsCaller.run(ZygoteInit.java:860)
09-23 10:38:29.043: ERROR/AndroidRuntime(1435): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
09-23 10:38:29.043: ERROR/AndroidRuntime(1435): at
dalvik.system.NativeStart.main(Native Method)
09-23 10:38:29.073: INFO/Process(123): Sending signal. PID: 1435 SIG:
3
09-23 10:38:29.073: INFO/dalvikvm(1435): threadid=7: reacting to
signal 3
09-23 10:38:29.093: INFO/dalvikvm(1435): Wrote stack trace to '/data/
anr/traces.txt'
09-23 10:38:29.283: DEBUG/ViewFlipper(1163): updateRunning()
mVisible=false, mStarted=true, mUserPresent=true, mRunning=false
09-23 10:38:38.497: WARN/ActivityManager(123): Launch timeout has
expired, giving up wake lock!
09-23 10:38:38.787: WARN/ActivityManager(123): Activity idle timeout
for HistoryRecord{43fa0588 edu.mit.media.hlt.sensorgraph/.SensorGraph}

Bonifaz

unread,
Sep 23, 2010, 1:00:14 PM9/23/10
to Amarino Toolkit
Oh yes the library is not linked to your application.

I normally use Eclipse to compile and install Android applications on
the phone.
It is much easier than using ant build scripts on your own.

Install Eclipse and the ADT plug-in to have a proper Android
development platform set up.
http://developer.android.com/guide/developing/eclipse-adt.html

Then import a exisiting project into your Eclipse workspace. Choose
the SensorGraph directory and import it.
Afterwards set your Build Path in your SensorGraph project settings
and locate the AmarinoLibrary.jar file.
Add it as an external library.

At the end you have to choose Run as Android application and Eclipse
will compile and install it on your phone.


The other option is to find out how to integrate the library in your
ant build.xml file properly in order to have it available during
runtime.

durn

unread,
Sep 23, 2010, 2:58:16 PM9/23/10
to Amarino Toolkit
My problem is that my companies network security prevents me from
updating my adt plugin so I am unable to use android with eclipse. I
have looked for a while, but I have no idea how to add the proper
stuff to build.xml to get the library properly linked. Does anyone
know how to do this?

durn

unread,
Sep 23, 2010, 3:00:47 PM9/23/10
to Amarino Toolkit
Perhaps Eclipse modified the build.xml file? If that is the case
could someone please send me a valid build.xml file for the
SensorGraph example?

durn

unread,
Sep 23, 2010, 3:52:25 PM9/23/10
to Amarino Toolkit
It turns out of I put the jar file in a directory called libs in the
project directory it is properly added to the apk. Still seems like a
bit of a hack though

Bonifaz

unread,
Sep 23, 2010, 4:22:52 PM9/23/10
to Amarino Toolkit
Actually, it is supposed to be in the libs directory of your app.

So it does work now for you?

durn

unread,
Sep 23, 2010, 5:38:05 PM9/23/10
to Amarino Toolkit
Yes it works now thank you. On a separate note is there an easy way
to check if you have made a good connection with the arduino board?
Right now the only way I have thought of is to have the arduino
continuously send a "connected" string on start up and then when my
app receives it I know that they have made a good connection.

Bonifaz

unread,
Sep 24, 2010, 5:06:46 AM9/24/10
to Amarino Toolkit
Amarino broadcasts an Amarino.ACTION_CONNECTED intent when the
connection has been established.
You can receive this intent by registering a BroadcastReceiver which
listens to Amarino.ACTION_CONNECTED intents.
Look at the Amarino API, there are also other useful information
Amarino will broadcast.

To check if the Arduino is connected to your phone after you got a
successful connection, is not really supported by the bluetooth stack
nor does Amarino it.
The only thing you can do is sending constantly a heart beat like you
did ( I would choose a shorter message, though) or let your phone ask
the Arduino if connection is still up and running. Either way, you
need to actively check it on your own.

For example:
The phone sends "ON?" - Arduino response is "ON?". ( you could use a
special event id, flag, for this message and register a callback in
Arduino for that message which just returns what it received, the
phone then checks if it got the same message back which is has sent)
You phone might implement the routine in a way that it only
occasionally sends the inquiry and ommit it when it received other
information of your Arduino, since then it knows that the connection
must work.
Reply all
Reply to author
Forward
0 new messages