我尝试在我的安卓应用程序中使用语言工具库 http://www.languagetool.org/java-api/,
try
{
JLanguageTool langTool = new JLanguageTool(new Polish());
}
catch (IOException e) {}
但是我收到错误。我使用 Modules-->Dependencies-->Add-->library -->from maven 添加了 maven 库。
当我将其作为控制台应用程序进行测试时,一切正常。
11-07 19:54:35.071: ERROR/AndroidRuntime(2982): FATAL EXCEPTION: main
java.lang.ExceptionInInitializerError
at com.example.orto_test.MyActivity.onCreate(MyActivity.java:35)
at android.app.Activity.performCreate(Activity.java:5206)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2074)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2135)
at android.app.ActivityThread.access$700(ActivityThread.java:140)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1237)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4921)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1027)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at org.languagetool.JLanguageTool.getBuildDate(JLanguageTool.java:93)
at org.languagetool.JLanguageTool.<clinit>(JLanguageTool.java:77)
... 15 more
提前感谢!
http://languagetool-user-forum.2306527.n4.nabble.com/ClassDefNotFoundError-org-languagetool-language-AmericanEnglish-td4641443.html Languagtool 2.2可以在Android上成功使用。您可能想联系语言工具-用户-论坛,如果您在使事情正常工作时遇到问题。