crash - Android app crashes when any math parser is included -


i trying develop app crashes when include sort of math parser. app works fine otherwise when comment out math parser. tried other parsers, still same problem. ideas why happening? below screen shots.

  1. manifest enter image description here

  2. mainactivity file enter image description here

  3. project explorer

enter image description here

logcat

04-24 01:13:15.440: d/androidruntime(3481): shutting down vm 04-24 01:13:15.440: w/dalvikvm(3481): threadid=1: thread exiting uncaught exception (group=0xb1a74ba8) 04-24 01:13:15.460: e/androidruntime(3481): fatal exception: main 04-24 01:13:15.460: e/androidruntime(3481): process: com.example.calculator, pid: 3481 04-24 01:13:15.460: e/androidruntime(3481): java.lang.runtimeexception: unable start activity componentinfo{com.example.calculator/com.example.calculator.mainactivity}: java.util.regex.patternsyntaxexception: syntax error in regexp pattern near index 1: 04-24 01:13:15.460: e/androidruntime(3481): } 04-24 01:13:15.460: e/androidruntime(3481):  ^ 04-24 01:13:15.460: e/androidruntime(3481):     @ android.app.activitythread.performlaunchactivity(activitythread.java:2195) 04-24 01:13:15.460: e/androidruntime(3481):     @ android.app.activitythread.handlelaunchactivity(activitythread.java:2245) 04-24 01:13:15.460: e/androidruntime(3481):     @ android.app.activitythread.access$800(activitythread.java:135) 04-24 01:13:15.460: e/androidruntime(3481):     @ android.app.activitythread$h.handlemessage(activitythread.java:1196) 04-24 01:13:15.460: e/androidruntime(3481):     @ android.os.handler.dispatchmessage(handler.java:102) 04-24 01:13:15.460: e/androidruntime(3481):     @ android.os.looper.loop(looper.java:136) 04-24 01:13:15.460: e/androidruntime(3481):     @ android.app.activitythread.main(activitythread.java:5017) 04-24 01:13:15.460: e/androidruntime(3481):     @ java.lang.reflect.method.invokenative(native method) 04-24 01:13:15.460: e/androidruntime(3481):     @ java.lang.reflect.method.invoke(method.java:515) 04-24 01:13:15.460: e/androidruntime(3481):     @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:779) 04-24 01:13:15.460: e/androidruntime(3481):     @ com.android.internal.os.zygoteinit.main(zygoteinit.java:595) 04-24 01:13:15.460: e/androidruntime(3481):     @ dalvik.system.nativestart.main(native method) 04-24 01:13:15.460: e/androidruntime(3481): caused by: java.util.regex.patternsyntaxexception: syntax error in regexp pattern near index 1: 04-24 01:13:15.460: e/androidruntime(3481): } 04-24 01:13:15.460: e/androidruntime(3481):  ^ 04-24 01:13:15.460: e/androidruntime(3481):     @ java.util.regex.pattern.compileimpl(native method) 04-24 01:13:15.460: e/androidruntime(3481):     @ java.util.regex.pattern.compile(pattern.java:411) 04-24 01:13:15.460: e/androidruntime(3481):     @ java.util.regex.pattern.<init>(pattern.java:394) 04-24 01:13:15.460: e/androidruntime(3481):     @ java.util.regex.pattern.compile(pattern.java:381) 04-24 01:13:15.460: e/androidruntime(3481):     @ java.lang.string.replaceall(string.java:1785) 04-24 01:13:15.460: e/androidruntime(3481):     @ com.google.code.mathparser.constants.utils.mathparserutils.transformgropcharsintoparentheses(mathparserutils.java:41) 04-24 01:13:15.460: e/androidruntime(3481):     @ com.google.code.mathparser.validators.expressionvalidator.evalifexpressioniswellformed(expressionvalidator.java:44) 04-24 01:13:15.460: e/androidruntime(3481):     @ com.google.code.mathparser.validators.expressionvalidator.validate(expressionvalidator.java:38) 04-24 01:13:15.460: e/androidruntime(3481):     @ com.google.code.mathparser.parser.lexicaltokenizer.validateexpression(lexicaltokenizer.java:116) 04-24 01:13:15.460: e/androidruntime(3481):     @ com.google.code.mathparser.parser.lexicaltokenizer.assignnewexpression(lexicaltokenizer.java:59) 04-24 01:13:15.460: e/androidruntime(3481):     @ com.google.code.mathparser.parser.lexicaltokenizer.setexpression(lexicaltokenizer.java:47) 04-24 01:13:15.460: e/androidruntime(3481):     @ com.google.code.mathparser.parser.parser.splitexpressionintokens(parser.java:206) 04-24 01:13:15.460: e/androidruntime(3481):     @ com.google.code.mathparser.parser.parser.shuntingyardalgorithm(parser.java:69) 04-24 01:13:15.460: e/androidruntime(3481):     @ com.google.code.mathparser.parser.parser.setexpression(parser.java:50) 04-24 01:13:15.460: e/androidruntime(3481):     @ com.google.code.mathparser.impl.mathparserimpl.calculate(mathparserimpl.java:33) 04-24 01:13:15.460: e/androidruntime(3481):     @ com.example.calculator.mainactivity.oncreate(mainactivity.java:42) 04-24 01:13:15.460: e/androidruntime(3481):     @ android.app.activity.performcreate(activity.java:5231) 04-24 01:13:15.460: e/androidruntime(3481):     @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1087) 04-24 01:13:15.460: e/androidruntime(3481):     @ android.app.activitythread.performlaunchactivity(activitythread.java:2159) 04-24 01:13:15.460: e/androidruntime(3481):     ... 11 more 

it might post activity.java instead of screenshot.

your app crashing because result , mathparser being declared outside scope of can initialized. (''where can live''). right you'd getting null pointer exception , resultant crash.

please check more info on same.

for now, can shift lines of mathparser , result inside oncreate() , should work.


Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -