1

有人可以帮我如何lpsolve55j.jar在 Android 设备上使用。我尝试像其他所有库一样导入它(将其放在 libs 文件夹中并将其添加到 JavaBuildPath -> Libraries 中),但出现此错误:

03-07 15:28:52.910: W/dalvikvm(3421): Exception Ljava/lang/UnsatisfiedLinkError; thrown while initializing Llpsolve/LpSolve;
03-07 15:28:52.910: D/AndroidRuntime(3421): Shutting down VM
03-07 15:28:52.910: W/dalvikvm(3421): threadid=1: thread exiting with uncaught exception (group=0x9e495930)
03-07 15:28:52.910: E/AndroidRuntime(3421): FATAL EXCEPTION: main
03-07 15:28:52.910: E/AndroidRuntime(3421): java.lang.UnsatisfiedLinkError: Couldn't load lpsolve55j from loader dalvik.system.PathClassLoader[dexPath=/data/app/com.app.cutstockan-2.apk,libraryPath=/data/app-lib/com.app.cutstockan-2]: findLibrary returned null
03-07 15:28:52.910: E/AndroidRuntime(3421):     at java.lang.Runtime.loadLibrary(Runtime.java:365)
03-07 15:28:52.910: E/AndroidRuntime(3421):     at java.lang.System.loadLibrary(System.java:535)
03-07 15:28:52.910: E/AndroidRuntime(3421):     at lpsolve.LpSolve.<clinit>(LpSolve.java:275)
03-07 15:28:52.910: E/AndroidRuntime(3421):     at com.app.cutstockan.Calculate.generateEquations(Calculate.java:123)
03-07 15:28:52.910: E/AndroidRuntime(3421):     at com.app.cutstockan.Calculate.<init>(Calculate.java:52)
03-07 15:28:52.910: E/AndroidRuntime(3421):     at com.app.cutstockan.Main$1.onClick(Main.java:37)
03-07 15:28:52.910: E/AndroidRuntime(3421):     at android.view.View.performClick(View.java:4204)
03-07 15:28:52.910: E/AndroidRuntime(3421):     at android.view.View$PerformClick.run(View.java:17355)
03-07 15:28:52.910: E/AndroidRuntime(3421):     at android.os.Handler.handleCallback(Handler.java:725)
03-07 15:28:52.910: E/AndroidRuntime(3421):     at android.os.Handler.dispatchMessage(Handler.java:92)
03-07 15:28:52.910: E/AndroidRuntime(3421):     at android.os.Looper.loop(Looper.java:137)
03-07 15:28:52.910: E/AndroidRuntime(3421):     at android.app.ActivityThread.main(ActivityThread.java:5202)
03-07 15:28:52.910: E/AndroidRuntime(3421):     at java.lang.reflect.Method.invokeNative(Native Method)
03-07 15:28:52.910: E/AndroidRuntime(3421):     at java.lang.reflect.Method.invoke(Method.java:511)
03-07 15:28:52.910: E/AndroidRuntime(3421):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
03-07 15:28:52.910: E/AndroidRuntime(3421):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:562)
03-07 15:28:52.910: E/AndroidRuntime(3421):     at dalvik.system.NativeStart.main(Native Method)
03-07 15:28:54.650: I/Process(3421): Sending signal. PID: 3421 SIG: 9

编辑

好的,所以我需要这个来解决不平等系统。有人可以帮我找到可以解决这个问题的图书馆的替代品吗?

4

1 回答 1

2

Apache Commons Math是一个纯 Java 库,其中包含例如用于求解线性程序的 Simplex 算法。这个库的二进制文件应该可以在 Android 应用程序中按原样使用,或者应该直接为 Android 构建库。

相关的单元测试用例充分说明了使用Apache Commons Math SimplexSolver解决不同类型的较小 LP 问题。

于 2013-03-08T09:51:31.917 回答