MPAndroidChart LineChart crash - charts

FATAL EXCEPTION: main
Process: PID: 9915
java.lang.NullPointerException: Attempt to invoke virtual method 'float
com.github.mikephil.charting.data.Entry.getX()' on a null object reference
at com.github.mikephil.charting.renderer.LineChartRenderer.drawCubicBezier(LineChartRenderer.java:236)
at enter code herecom.github.mikephil.charting.renderer.LineChartRenderer.drawDataSet(LineChartRenderer.java:123)
at com.github.mikephil.charting.renderer.LineChartRenderer.drawData(LineChartRenderer.java:101)
at com.github.mikephil.charting.charts.BarLineChartBase.onDraw(BarLineChartBase.java:237)

Related

Unable to build flutter application after updating

I am unable to build flutter application using the following environment
environment:
sdk: '>=2.18.5 <3.0.0'
I am getting below error
Error output from Xcode build:
error: the following command failed with exit code 0 but produced no further output
error: the following command failed with exit code 0 but produced no further output
: Error: Type 'EditableTextContextMenuBuilder' not found.
text_field.dart:558
: Error: Method 'insert' cannot be called on 'OverlayState?' because it is potentially null.
search_field.dart:244
: Error: Undefined name 'CupertinoAdaptiveTextSelectionToolbar'.
text_field.dart:442
: Error: 'EditableTextContextMenuBuilder' isn't a type.
text_field.dart:558
: Error: 'EditableTextContextMenuBuilder' isn't a type.
text_field.dart:870
: Error: No named parameter with the name 'contextMenuBuilder'.
text_field.dart:1395
: Error: A value of type 'OverlayState?' can't be assigned to a variable of type 'OverlayState' because 'OverlayState?' is nullable and 'OverlayState' isn't.
tooltip.dart:170
: Error: Method 'writeState' cannot be called on 'PageStorageBucket?' because it is potentially null.

how do i solve the flutter problem "Error.throwWithStackTrace"

`Launching lib\main.dart on Chrome in debug mode...
: Error: Method not found: 'Error.throwWithStackTrace'.
Error.throwWithStackTrace(exception, stackTrace);
^^^^^^^^^^^^^^^^^^^
: Error: Method not found: 'Error.throwWithStackTrace'.
Error.throwWithStackTrace(
^^^^^^^^^^^^^^^^^^^
: Error: A non-null value must be returned since the return type 'Never' doesn't allow null.
Never convertPlatformException(Object exception, StackTrace stackTrace) {
^
Failed to compile application.
Exited (sigterm)
what is the solution`

Unable to start service rekab.app.background_locator.IsolateHolderService

I use background_locator to track geo_location when the user activates tracking by clicking a button. The location is then posted to an API, which logs it in a database.
The feature works in debug mode, but crashes with the following exception, in release mode:
E/AndroidRuntime(31736): FATAL EXCEPTION: main
E/AndroidRuntime(31736): Process: za.co.liquidedge.celltrack, PID: 31736
E/AndroidRuntime(31736): java.lang.RuntimeException: Unable to start service rekab.app.background_locator.IsolateHolderServiceolateHolderService (has extras) }: java.lang.RuntimeException: Missing type parameter.
E/AndroidRuntime(31736): at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:4759)
E/AndroidRuntime(31736): at android.app.ActivityThread.access$1900(ActivityThread.java:301)
E/AndroidRuntime(31736): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2186)
E/AndroidRuntime(31736): at android.os.Handler.dispatchMessage(Handler.java:106)6)
E/AndroidRuntime(31736): at android.os.Looper.loop(Looper.java:246) a:8506)
E/AndroidRuntime(31736): at android.app.ActivityThread.main(ActivityThread.java:8506) aller.run(RuntimeInit.java:602)
E/AndroidRuntime(31736): at com.android.internal.os.RuntimeInit$MethodAndArgsC.java:1130)aller.run(RuntimeInit.java:602) r.
E/AndroidRuntime(31736): at com.android.internal.os.ZygoteInit.main(ZygoteInite:26).java:1130)
E/AndroidRuntime(31736): Caused by: java.lang.RuntimeException: Missing type parametece:0)r. )
E/AndroidRuntime(31736): at d.c.c.O.a.getSuperclassTypeParameter(Unknown Sourc23)e:26) onStartCommand(:11)
E/AndroidRuntime(31736): at d.c.c.O.a.<init>(Unknown Source:7) ityThread.java:4741)
E/AndroidRuntime(31736): at rekab.app.background_locator.e.<init>(Unknown Source:0)
E/AndroidRuntime(31736): at rekab.app.background_locator.f.b(Unknown Source:24)
E/AndroidRuntime(31736): at rekab.app.background_locator.g.d.a(Unknown Source:23)
E/AndroidRuntime(31736): at rekab.app.background_locator.IsolateHolderService.onStartCommand(:11)
E/AndroidRuntime(31736): at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:4741)
I fixed this issue by adding these rules to android/app/proguard-rules.pro
# Gson uses generic type information stored in a class file when working with fields. Proguard
# removes such information by default, so configure it to keep all of it.
-keepattributes Signature
# Gson specific classes
-keep class sun.misc.Unsafe { *; }
#-keep class com.google.gson.stream.** { *; }
# Application classes that will be serialized/deserialized over Gson
-keep class com.google.gson.examples.android.model.** { *; }

GroovyTemplate of test runner throws exceptions and won't show error detail

Sometimes when a scalatest fails, Play test framework does not report the cause of the failure, instead I see the following. Any ideas why?
Reporter completed abruptly with an exception after receiving event:
TestFailed(org.scalatest.events.Ordinal#6db,java.util.NoSuchElementException,AsgUpdateActorTest,Some(com.netflix.tachyon.nac.AsgUpdateActorTest),parse xml,Some(java.util.NoSuchElementException),Some(42),None,Some(<function7>),None,play-thread-1,1324496590792).
java.lang.NullPointerException
at play.test.TestEngine$TestResults.add(TestEngine.java:191)
at org.scalatest.tools.PlayReporter.apply(ScalaTestRunner.scala:122)
at org.scalatest.DispatchReporter$$anonfun$1$$anonfun$apply$1$$anonfun$apply$2.apply(DispatchReporter.scala:152)
at org.scalatest.DispatchReporter$$anonfun$1$$anonfun$apply$1$$anonfun$apply$2.apply(DispatchReporter.scala:151)
at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:61)
at scala.collection.immutable.List.foreach(List.scala:45)
at org.scalatest.DispatchReporter$$anonfun$1$$anonfun$apply$1.apply(DispatchReporter.scala:151)
at org.scalatest.DispatchReporter$$anonfun$1$$anonfun$apply$1.apply(DispatchReporter.scala:101)
at scala.actors.Actor$class.receive(Actor.scala:524)
at scala.actors.Actor$$anon$1.receive(Actor.scala:134)
at scala.actors.Actor$.receive(Actor.scala:189)
at org.scalatest.DispatchReporter$$anonfun$1.apply(DispatchReporter.scala:101)
at org.scalatest.DispatchReporter$$anonfun$1.apply(DispatchReporter.scala:50)
at scala.Function0$class.apply$mcV$sp(Function0.scala:39)
at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:17)
at scala.actors.Actor$$anon$1.act(Actor.scala:135)
at scala.actors.Reactor$$anonfun$dostart$1.apply(Reactor.scala:222)
at scala.actors.Reactor$$anonfun$dostart$1.apply(Reactor.scala:222)
at scala.actors.ReactorTask.run(ReactorTask.scala:36)
at scala.concurrent.forkjoin.ForkJoinPool$AdaptedRunnable.exec(ForkJoinPool.java:611)
at scala.concurrent.forkjoin.ForkJoinTask.quietlyExec(ForkJoinTask.java:422)
at scala.concurrent.forkjoin.ForkJoinWorkerThread.mainLoop(ForkJoinWorkerThread.java:340)
at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:325)
11:43:11,038 ERROR ~
#68nef9k71
Cannot ouput XML unit output
Template execution error (In {module:testrunner}/app/views/TestRunner/results-xunit.xml around line 23)
Execution error occured in template {module:testrunner}/app/views/TestRunner/results-xunit.xml. Exception raised was NullPointerException : Cannot invoke method escapeXml() on null object.
play.exceptions.TemplateExecutionException: Cannot invoke method escapeXml() on null object
at play.templates.BaseTemplate.throwException(BaseTemplate.java:86)
at play.templates.GroovyTemplate.internalRender(GroovyTemplate.java:257)
at play.templates.Template.render(Template.java:26)
at play.templates.GroovyTemplate.render(GroovyTemplate.java:187)
at controllers.TestRunner.run(TestRunner.java:79)
at play.mvc.ActionInvoker.invokeWithContinuation(ActionInvoker.java:548)
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:502)
at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:478)
at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:473)
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:161)
at Invocation.HTTP Request(Play!)
Caused by: java.lang.NullPointerException: Cannot invoke method escapeXml() on null object
at {module:testrunner}/app/views/TestRunner/results-xunit.xml.(line:23)
at play.templates.GroovyTemplate.internalRender(GroovyTemplate.java:232)
... 9 more
Update:
It happened because of the following exception that the test had triggered. Does the test framework supposed to blow up when a test throws an exception?
java.util.NoSuchElementException
at scala.collection.IterableLike$class.head(IterableLike.scala:101)
at scala.xml.NodeSeq.head(NodeSeq.scala:43)

Drools: Compiling rules (or loading compiled rules) fails with obscure exceptions in JamVM

I'm developing a framework that, as one of its features, enables robots to use a rule based system. We began with Jess as the RBS, and now wanted to implement drools (using Drools 5.2.0 final), which works on our development machines running on OpenJDK 6.
Our robot controller runs ARM Linux and JamVM, previously 1.4.3, but I recently compiled 1.5.4 because it was missing classes needed by drools. After failures, I installed JamVM in a virtual machine using the same configurations as when I compiled it for the controller, and there it failed with the same exceptions.
A little research showed that there are bug reports for Drools + JamVM, but this also means that it generally does work.
When Running the framework with precompiled rules with the following code...
kBase = KnowledgeBaseFactory.newKnowledgeBase();
ObjectInputStream in;
Collection<KnowledgePackage> kpkgs;
try {
in = new ObjectInputStream(Thread.currentThread().getContextClassLoader().getResourceAsStream(
packageFile));
kpkgs = (Collection<KnowledgePackage>) in.readObject();
in.close();
} catch(IOException e) {
throw new DisboticsException("Couldn't read drools knowledge package file!", e);
} catch(ClassNotFoundException e) {
throw new DisboticsException("Drools knowledge package file didn't contain expected instance.", e);
}
kBase.addKnowledgePackages(kpkgs);
kSession = kBase.newStatefulKnowledgeSession();
...I got this exception:
java.lang.UnsupportedOperationException
at java.util.AbstractList.add(AbstractList.java:131)
at java.util.AbstractList.add(AbstractList.java:152)
at org.drools.rule.JavaDialectRuntimeData.write(JavaDialectRuntimeData.java:383)
at org.drools.rule.JavaDialectRuntimeData.merge(JavaDialectRuntimeData.java:266)
at org.drools.rule.JavaDialectRuntimeData.clone(JavaDialectRuntimeData.java:251)
at org.drools.rule.DialectRuntimeRegistry.merge(DialectRuntimeRegistry.java:110)
at org.drools.common.AbstractRuleBase.addPackages(AbstractRuleBase.java:496)
at org.drools.reteoo.ReteooRuleBase.addPackages(ReteooRuleBase.java:427)
at org.drools.impl.KnowledgeBaseImpl.addKnowledgePackages(KnowledgeBaseImpl.java:149)
at disbotics.core.config.DroolsRulesPlugin.initialize(DroolsRulesPlugin.java:76)
at disbotics.core.common.DisboticsCore.startFramework(DisboticsCore.java:109)
at disbotics.core.common.DisboticsCore.main(DisboticsCore.java:56)
Exception in thread "main" org.drools.RuntimeDroolsException: java.lang.UnsupportedOperationException
at org.drools.rule.JavaDialectRuntimeData.write(JavaDialectRuntimeData.java:386)
at org.drools.rule.JavaDialectRuntimeData.merge(JavaDialectRuntimeData.java:266)
at org.drools.rule.JavaDialectRuntimeData.clone(JavaDialectRuntimeData.java:251)
at org.drools.rule.DialectRuntimeRegistry.merge(DialectRuntimeRegistry.java:110)
at org.drools.common.AbstractRuleBase.addPackages(AbstractRuleBase.java:496)
at org.drools.reteoo.ReteooRuleBase.addPackages(ReteooRuleBase.java:427)
at org.drools.impl.KnowledgeBaseImpl.addKnowledgePackages(KnowledgeBaseImpl.java:149)
at disbotics.core.config.DroolsRulesPlugin.initialize(DroolsRulesPlugin.java:76)
at disbotics.core.common.DisboticsCore.startFramework(DisboticsCore.java:109)
at disbotics.core.common.DisboticsCore.main(DisboticsCore.java:56)
Caused by: java.lang.UnsupportedOperationException
at java.util.AbstractList.add(AbstractList.java:131)
at java.util.AbstractList.add(AbstractList.java:152)
at org.drools.rule.JavaDialectRuntimeData.write(JavaDialectRuntimeData.java:383)
...9 more
...which works in OpenJDK. weirdly, it turns out that the list in question in JavaDialectRuntimeData is obtained via Collections.emptyList() and is never changed again (or so eclipse suggests...).
When running with bare .drl files using this code:
Properties props = new Properties();
props.put("drools.dialect.java.compiler", "JANINO");
KnowledgeBuilderConfiguration kbConfig = KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration(props,
(ClassLoader[]) null);
KnowledgeBuilder kBuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(kbConfig);
kBuilder.add(ResourceFactory.newClassPathResource("disbotics/core/rules/drools/function.drl",
DroolsRulesPlugin.class), ResourceType.DRL);
kBuilder.add(ResourceFactory.newClassPathResource(rulesFile, DroolsRulesPlugin.class), ResourceType.DRL);
if(kBuilder.hasErrors()) {
String errorMessage = "";
for(KnowledgeBuilderError error:kBuilder.getErrors())
errorMessage = errorMessage + error.getMessage() + "\n";
throw new DisboticsException(errorMessage);
}
kBase = KnowledgeBaseFactory.newKnowledgeBase();
kBase.addKnowledgePackages(kBuilder.getKnowledgePackages());
kSession = kBase.newStatefulKnowledgeSession();
... I get these (unexpected) exceptions from the rules compiler:
Exception in thread "main" disbotics.core.common.DisboticsException: Line 2:8 unexpected exception at input '"mvel"'. Exception: java.lang.UnsupportedOperationException. Stack trace:
java.lang.UnsupportedOperationException
at java.util.AbstractList.add(AbstractList.java:131)
at java.util.AbstractList.add(AbstractList.java:152)
at org.drools.lang.descr.PackageDescr.addAttribute(PackageDescr.java:138)
at org.drools.lang.api.impl.PackageDescrBuilderImpl.attribute(PackageDescrBuilderImpl.java:93)
at org.drools.lang.ParserHelper.start(ParserHelper.java:684)
at org.drools.lang.DRLParser.stringAttribute(DRLParser.java:1289)
at org.drools.lang.DRLParser.attribute(DRLParser.java:1062)
at org.drools.lang.DRLParser.statement(DRLParser.java:276)
at org.drools.lang.DRLParser.compilationUnit(DRLParser.java:155)
at org.drools.compiler.DrlParser.compile(DrlParser.java:225)
at org.drools.compiler.DrlParser.parse(DrlParser.java:136)
at org.drools.compiler.DrlParser.parse(DrlParser.java:141)
at org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:352)
at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:538)
at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:28)
at disbotics.core.config.DroolsRulesPlugin.initialize(DroolsRulesPlugin.java:55)
at disbotics.core.common.DisboticsCore.startFramework(DisboticsCore.java:109)
at disbotics.core.common.DisboticsCore.main(DisboticsCore.java:56)
[ERR 107] Line 2:8 mismatched input '"mvel"' expecting one of the following tokens: '[package, import, global, declare, function, rule, query]'.
Line 4:0 unexpected exception at input 'global'. Exception: java.util.EmptyStackException. Stack trace:
java.util.EmptyStackException
at java.util.Stack.pop(Stack.java:109)
at org.drools.lang.ParserHelper.popParaphrases(ParserHelper.java:421)
at org.drools.lang.ParserHelper.end(ParserHelper.java:732)
at org.drools.lang.DRLParser.globalStatement(DRLParser.java:401)
at org.drools.lang.DRLParser.statement(DRLParser.java:261)
at org.drools.lang.DRLParser.compilationUnit(DRLParser.java:155)
at org.drools.compiler.DrlParser.compile(DrlParser.java:225)
at org.drools.compiler.DrlParser.parse(DrlParser.java:136)
at org.drools.compiler.DrlParser.parse(DrlParser.java:141)
at org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:352)
at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:538)
at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:28)
at disbotics.core.config.DroolsRulesPlugin.initialize(DroolsRulesPlugin.java:55)
at disbotics.core.common.DisboticsCore.startFramework(DisboticsCore.java:109)
at disbotics.core.common.DisboticsCore.main(DisboticsCore.java:56)
Parser returned a null Package
Line 2:8 unexpected exception at input '"java"'. Exception: java.lang.UnsupportedOperationException. Stack trace:
java.lang.UnsupportedOperationException
at java.util.AbstractList.add(AbstractList.java:131)
at java.util.AbstractList.add(AbstractList.java:152)
at org.drools.lang.descr.PackageDescr.addAttribute(PackageDescr.java:138)
at org.drools.lang.api.impl.PackageDescrBuilderImpl.attribute(PackageDescrBuilderImpl.java:93)
at org.drools.lang.ParserHelper.start(ParserHelper.java:684)
at org.drools.lang.DRLParser.stringAttribute(DRLParser.java:1289)
at org.drools.lang.DRLParser.attribute(DRLParser.java:1062)
at org.drools.lang.DRLParser.statement(DRLParser.java:276)
at org.drools.lang.DRLParser.compilationUnit(DRLParser.java:155)
at org.drools.compiler.DrlParser.compile(DrlParser.java:225)
at org.drools.compiler.DrlParser.parse(DrlParser.java:136)
at org.drools.compiler.DrlParser.parse(DrlParser.java:141)
at org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:352)
at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:538)
at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:28)
at disbotics.core.config.DroolsRulesPlugin.initialize(DroolsRulesPlugin.java:57)
at disbotics.core.common.DisboticsCore.startFramework(DisboticsCore.java:109)
at disbotics.core.common.DisboticsCore.main(DisboticsCore.java:56)
[ERR 107] Line 2:8 mismatched input '"java"' expecting one of the following tokens: '[package, import, global, declare, function, rule, query]'.
Line 4:0 unexpected exception at input 'import'. Exception: java.util.EmptyStackException. Stack trace:
java.util.EmptyStackException
at java.util.Stack.pop(Stack.java:109)
at org.drools.lang.ParserHelper.popParaphrases(ParserHelper.java:421)
at org.drools.lang.ParserHelper.end(ParserHelper.java:732)
at org.drools.lang.DRLParser.importStatement(DRLParser.java:349)
at org.drools.lang.DRLParser.statement(DRLParser.java:258)
at org.drools.lang.DRLParser.compilationUnit(DRLParser.java:155)
at org.drools.compiler.DrlParser.compile(DrlParser.java:225)
at org.drools.compiler.DrlParser.parse(DrlParser.java:136)
at org.drools.compiler.DrlParser.parse(DrlParser.java:141)
at org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:352)
at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:538)
at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:28)
at disbotics.core.config.DroolsRulesPlugin.initialize(DroolsRulesPlugin.java:57)
at disbotics.core.common.DisboticsCore.startFramework(DisboticsCore.java:109)
at disbotics.core.common.DisboticsCore.main(DisboticsCore.java:56)
Line 6:0 unexpected exception at input 'rule'. Exception: java.util.EmptyStackException. Stack trace:
java.util.EmptyStackException
at java.util.Stack.pop(Stack.java:109)
at org.drools.lang.ParserHelper.popParaphrases(ParserHelper.java:421)
at org.drools.lang.ParserHelper.end(ParserHelper.java:732)
at org.drools.lang.DRLParser.rule(DRLParser.java:886)
at org.drools.lang.DRLParser.statement(DRLParser.java:267)
at org.drools.lang.DRLParser.compilationUnit(DRLParser.java:155)
at org.drools.compiler.DrlParser.compile(DrlParser.java:225)
at org.drools.compiler.DrlParser.parse(DrlParser.java:136)
at org.drools.compiler.DrlParser.parse(DrlParser.java:141)
at org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:352)
at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:538)
at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:28)
at disbotics.core.config.DroolsRulesPlugin.initialize(DroolsRulesPlugin.java:57)
at disbotics.core.common.DisboticsCore.startFramework(DisboticsCore.java:109)
at disbotics.core.common.DisboticsCore.main(DisboticsCore.java:56)
Parser returned a null Package
at disbotics.core.config.DroolsRulesPlugin.initialize(DroolsRulesPlugin.java:63)
at disbotics.core.common.DisboticsCore.startFramework(DisboticsCore.java:109)
at disbotics.core.common.DisboticsCore.main(DisboticsCore.java:56)
again, compiling the rules worked just fine in OpenJDK. We're using Janino, and it is properly referenced on the classpath (the classpath used at runtime is created by the Maven build, so contains all jars referenced by drools/janino/ anything else)
Does anyone know what's going on here and/or how to get Drools working with JamVM?
Are you compiling the knowledge packages using OpenJDK 1.6? and then trying to load it with 1.5.4? You should try compiling the original packages using 1.5.4 and see if you have the same errors.
For the stack trace, it looks like you are trying to add something to an unmodifiable list right?
Basically you are getting the exception here: kBase.addKnowledgePackages(kpkgs);
Right?