我有从here下载的示例代码,用于使用jscience。

但是当我使用它时,它会显示以下消息:

E/AndroidRuntime(1296): java.lang.NoClassDefFoundError:org.jscience.mathematics.function.Variable$Local


我想念什么吗?当然,我将jscience jar lib导入了我的项目。但是仍然无法弄清楚。

    Variable.Local<Rational> varX = new Variable.Local<Rational>("x");
    Variable.Local<Rational> varY = new Variable.Local<Rational>("y");

    // f(x, y) =  x² + x·y + 1;
    Polynomial<Rational> x = Polynomial.valueOf(Rational.ONE, varX);
    Polynomial<Rational> y = Polynomial.valueOf(Rational.ONE, varY);
    Polynomial<Rational> fx_y = x.pow(2).plus(x.times(y)).plus(Rational.ONE);
    System.out.println("f(x,y) = " + fx_y);

    // Evaluates f(1,0)
    System.out.println("f(1,0) = " + fx_y.evaluate(Rational.ONE, Rational.ZERO));

    // Calculates df(x,y)/dx
    System.out.println("df(x,y)/dx = " + fx_y.differentiate(varX));

最佳答案

org.jscience.mathematics.function.Variable$Local类肯定在JAR中:

$ jar tf JScience / lib / jscience.jar | grep变量\ $ Local
org / jscience / mathematics / function / Variable $ Local.class


验证所需的库是否已在JAR清单的Class-Path属性中列出;请使用类似引用here的工具来确保:

类路径:lib / jscience.jar lib / javolution.jar…


附录:作为@max注释中的noted,ADT 17库目录应命名为libs

关于android - java.lang.NoClassDefFoundError:org.jscience.mathematics.function.Variable $ Local,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/23827891/

10-09 01:42