Android - adding an external library to the project

I'm having problems adding the WEKA library to the project I'm working on. I followed a few tutorials that explain how to do this, including the Android Developers Guide:

http://developer.android.com/guide/appendix/faq/commontasks.html#addexternallibrary

and some posts on SO.

I created a folder in my project with the weka.jar file, created a new library (adding the weka.jar file to the library), and included this library in my build path. I also added a library on the Order and Export tab in the project properties.

I also tried importing the jar file so that the actual jar content is extracted to a directory in my project.

The end result of all this is that my project has the ability to build correctly and without errors, but when it comes time to run my code in the emulator, I get the following exception:

04-10 22: 52: 21.051: ERROR / dalvikvm (582): Could not find class 'weka.classifiers.trees.J48' referenced by edu.usc.student.composure.classifier.GaitClassifierImpl.

when j48 is a class reference i'm in my code.

Does anyone have any additional suggestions that I might have missed?

Thanks!

+7
android external jar
source share
2 answers

WEKA will not work on Android without changes. J48 , for example, requires the java.lang.Cloneable interface, which is not available on Android.

What you need to do is check the WEKA source code from Subversion, add it to your project (delete the JAR file), compile it and fix all the compilation errors. There may be a lot of them.

+4
source share

I just finished my first revision https://github.com/rjmarsan/Weka-for-Android

Hope this helps!

+5
source share

All Articles