-2

I am using java ml for lib svm. But I am getting java.lang.NoClassDefFoundError: libsvm.LibSVM$1 error while initializing a LibSvm object. I have added these lines in my gradle:

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:24.2.1'
    compile project(':javaml-0.1.7')
}

This is the Activity code. The error occurs when I initialize libSVM.

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

import net.sf.javaml.core.Dataset;

import libsvm.LibSVM;


public class MainActivity extends AppCompatActivity {

    public LibSVM libSVM;
    Dataset dataset;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
            libSVM = new LibSVM();

    }
}
halfer
  • 19,824
  • 17
  • 99
  • 186
Bashima
  • 122
  • 1
  • 9

1 Answers1

0

I only added the javaml-0.1.7.jar before. But there is also a libsvm.jar in the lib folder of javaml-0.1.7. Importing that library solved the problem.

Bashima
  • 122
  • 1
  • 9