我尝试在我的Android应用程序中使用LanguageTool库http://www.languagetool.org/java-api/,
try
{
JLanguageTool langTool = new JLanguageTool(new Polish());
}
catch (IOException e) {}
但是我收到了一个错误。我使用模块添加了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
提前致谢!
答案 0 :(得分:1)
根据http://languagetool-user-forum.2306527.n4.nabble.com/ClassDefNotFoundError-org-languagetool-language-AmericanEnglish-td4641443.html,Languagtool 2.2可以在Android上成功使用。如果您无法开始工作,可能需要联系languagetool-user-forum。