Back to LanguageTool Homepage - Privacy - Imprint

Unable to use LanguageTool in Android Studio


(Bianca) #1

Everytime I run the code i got the error ExceptionInitializeError. What would be the solution? thank you


(Daniel Naber) #2

What exactly do you run?


(Bianca) #3

I am trying to implement grammar checking on my application. I'm using LanguageTool 2.4 in android studio


(Daniel Naber) #4

Could you send the complete stacktrace? Why are you using LT 2.4, which is very old?


(Bianca) #6

Here

FATAL EXCEPTION: main
Process: com.example.bryan.languagetoolsample, PID: 26521
java.lang.ExceptionInInitializerError
at com.example.bryan.languagetoolsample.MainActivity$1.onClick(MainActivity.java:39)
at android.view.View.performClick(View.java:5714)
at android.widget.TextView.performClick(TextView.java:10926)
at android.view.View$PerformClick.run(View.java:22589)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:7325)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.net.URLConnection java.net.URL.openConnection()' on a null object reference
at org.languagetool.JLanguageTool.getBuildDate(JLanguageTool.java:111)
at org.languagetool.JLanguageTool.(JLanguageTool.java:90)
at com.example.bryan.languagetoolsample.MainActivity$1.onClick(MainActivity.java:39)
at android.view.View.performClick(View.java:5714)
at android.widget.TextView.performClick(TextView.java:10926)
at android.view.View$PerformClick.run(View.java:22589)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:7325)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

I also tried LT 3.4 but I had an issue with targetCompatibility. That's why I used LT 2.2


(Daniel Naber) #7

It seems to be this line: https://github.com/languagetool-org/languagetool/blob/v2.4/languagetool-core/src/main/java/org/languagetool/JLanguageTool.java#L111

However, someone with Android knowledge will need to comment on this...


(Bianca) #8

ohh, I see. I'll try to look a solution for that. Thanks a lot for your help.


#9

@yangyang @dnaber let me know how to use language tool in android studio.

thank you