Welcome Guest,Register Now
Log In

ANT Forum

Welcome guest, please Login or Register

   

ANT+ Plugin Sampler crashes - NoClassDefFoundError

Rank

Total Posts: 3

Joined 2013-04-18

PM

HI all:

I am running a Samsung Galaxy Nexus with an OTG usb cable and a Garmin ANT+ receiver stick. When I install the PluginSampler onto the phone and plug in the usb cable and receiver, I am able to load the app, but, when I click any of the buttons (ie. Heart Rate Display), the app crashes with a logcat error trace of:

06-11 12:24:46.187: E/AndroidRuntime(2760): FATAL EXCEPTION: main
06-11 12:24:46.187: E/AndroidRuntime(2760): java.lang.NoClassDefFoundError: com.dsi.ant.antplus.pluginsampler.Activity_HeartRateSampler$1
06-11 12:24:46.187: E/AndroidRuntime(2760): at com.dsi.ant.antplus.pluginsampler.Activity_HeartRateSampler.resetPcc(Activity_HeartRateSampler.java:130)
06-11 12:24:46.187: E/AndroidRuntime(2760): at com.dsi.ant.antplus.pluginsampler.Activity_HeartRateSampler.onCreate(Activity_HeartRateSampler.java:90)
06-11 12:24:46.187: E/AndroidRuntime(2760): at android.app.Activity.performCreate(Activity.java:5104)
06-11 12:24:46.187: E/AndroidRuntime(2760): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
06-11 12:24:46.187: E/AndroidRuntime(2760): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2260)
06-11 12:24:46.187: E/AndroidRuntime(2760): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2356)
06-11 12:24:46.187: E/AndroidRuntime(2760): at android.app.ActivityThread.access$600(ActivityThread.java:150)
06-11 12:24:46.187: E/AndroidRuntime(2760): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1244)
06-11 12:24:46.187: E/AndroidRuntime(2760): at android.os.Handler.dispatchMessage(Handler.java:99)
06-11 12:24:46.187: E/AndroidRuntime(2760): at android.os.Looper.loop(Looper.java:137)
06-11 12:24:46.187: E/AndroidRuntime(2760): at android.app.ActivityThread.main(ActivityThread.java:5195)
06-11 12:24:46.187: E/AndroidRuntime(2760): at java.lang.reflect.Method.invokeNative(Native Method)
06-11 12:24:46.187: E/AndroidRuntime(2760): at java.lang.reflect.Method.invoke(Method.java:511)
06-11 12:24:46.187: E/AndroidRuntime(2760): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
06-11 12:24:46.187: E/AndroidRuntime(2760): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:562)
06-11 12:24:46.187: E/AndroidRuntime(2760): at dalvik.system.NativeStart.main(Native Method)


Any suggestions?

Thanks
Darren
     
Avatar
RankRankRankRank

Total Posts: 744

Joined 2012-09-14

PM

Hi Darren,

This indicates some necessary classes weren't available at runtime.

If you were just installing the prebuilt Plugin Sampler APK, have you also installed the ANT Radio Service, ANT+ Plugins, and ANT USB Service?

If you were building from the source code, besides having all of the services installed, I would also check your Android Manifest to see if all the Sampler classes are present still, and the libraries are present in the build path. The plugin sampler will require the plugin library.

Cheers      
Rank

Total Posts: 3

Joined 2013-04-18

PM

Thanks for the help. Turned out that through my fiddling, in the Application tab in the Manifest file, the Application Nodes just said "Activity" for all of them, and not any names of the classes. I just started fresh with a new unzipped source code package from the API.

However, afterwards I ran into the same error that is posted here about "no connection available' when using a USB stick. All good though, just installed the Acquire Channels app from the API and establish a channel first, then run the SamplePlugins app. All good smile

Thanks!      
Rank

Total Posts: 2

Joined 2013-06-26

PM

I cannot get PluginSampler to work properly either, having a similar issue to the one above.
I must be doing something trivial wrong... can you please help by pointing out what it is?

My setup:
adt-bundle-windows-x86-20130522 Build: v22.0.1-685705
ANT+ Android SDK
Sony Xperia S phone, with ANT Radio Service and ANT+ Plugins installed
Nexus One emulated device in Android VDM, with ANT Radio Service and ANT+ Plugins installed
(there is no ANT+ USB dongle in my PC, but the phone supports ANT+)

Steps I did:
1. start ADT
2. File > New > Project... > Android Project from Existing Code
3. Browse to directory ANT+ Android SDK\Samples\Source\ANT+\PluginSampler
4. Finish --> project is created successfuly, but it doesn'n compile, see screenshot:
antpluginsampler2.jpg 

5. Reason seems to be that API\ANT+ v1.8.0\antpluspluginlib.jar is not on the classpath
6. Project > Properties > Java build path > Add external JARs... > adding antpluspluginlib.jar
7. Afterwards the project compiles and the app starts up nicely in the emulator. As soon as I click an activity in the Dashboard...
8. The app crashes with "Unfortunately, ANT+ PluginSampler has stopped" , see screenshot:
antpluginsampler4b.jpg 

9. In logcat I get: E/dalvikvm(797): Could not find class 'com.dsi.ant.antplus.pluginsampler.Activity_HeartRateSampler$1', referenced from method com.dsi.ant.antplus.pluginsampler.Activity_HeartRateSampler.resetPcc
See screenshot:
antpluginsampler5.jpg 

10. The exact same thing happens when I execute the app on a Sony Xperia S phone.

Thank you very much for your support in advance.      

Image Attachments

antpluginsampler2.jpgantpluginsampler4b.jpgantpluginsampler5.jpg

Click thumbnail to see full-size image

Avatar
RankRankRankRank

Total Posts: 744

Joined 2012-09-14

PM

Hi,

Two things I would look at:
1) As above, ensure the Sampler Activities are present in the Manifest under Application Nodes, particularly in this case .Activity_HeartRateSampler (or com.dsi.ant.antplus.pluginsampler.heartrate.Activity_HeartRateSampler)

2) Take a look Under Project->Properties->Java Build Path->Order and Export
The project should be exporting the src, gen and Android Dependencies, and the src should be exported first before gen.

Also, typically it's recommended to put libraries in the libs folder and let Android include the library in the project automatically rather than manually add the library to the classpath.

Cheers      
Rank

Total Posts: 2

Joined 2013-06-26

PM

Hello,

Thanks for your support.

For 1) : the Manifest file I haven't touched, it was as it came from the sample package, so it must have been fine.

2) was probably the issue, here too I don't understand why these project settings were not picked up correctly from the sample package.

Anyway, in the meantime I've moved on building my own Android app, which was building nicely and connecting to the plugin runtime properly from the beginning. So, issue resolved smile

Thanks again.

S.