strange exception -- java.lang.RuntimeException: mBaselineAlignedChildIndex of LinearLayout set to an index that is out of bounds
I read that this exception means that I added a LinearLayout that had no children but I checked the suspected layout and it has 21 children. The exception doesn't seem to get raised until after the suspected layout (main) gets added to the screen so I guess it has a nested linearlayout has has no children, but there are alot of linearlayouts nested in there - so is there a quick way to find which one or to otherwise debug this?
Thanks
PS: seems when I step through this code I get frequent "out of memory" eclipse crashes too.
PPS: Here is the exception stack from the error log:
com.sun.jdi.InternalException: Got invalid data:java.io.UTFDataFormatException: Second byte input does not match UTF Specification
at org.eclipse.jdi.internal.MirrorImpl.defaultIOExceptionHandler(MirrorImpl.java:269)
at org.eclipse.jdi.internal.VirtualMachineImpl.allClasses(VirtualMachineImpl.java:370)
at org.eclipse.jdi.internal.VirtualMachineImpl.allRefTypes(VirtualMachineImpl.java:382)
at org.eclipse.jdi.internal.ReferenceTypeImpl.nestedTypes(ReferenceTypeImpl.java:1105)
at org.eclipse.jdt.internal.debug.eval.ast.engine.BinaryBasedSourceGenerator.buildTypeDeclaration(BinaryBasedSourceGenerator.java:310)
at org.eclipse.jdt.internal.debug.eval.ast.engine.BinaryBasedSourceGenerator.buildTypeDeclaration(BinaryBasedSourceGenerator.java:322)
at org.eclipse.jdt.internal.debug.eval.ast.engine.BinaryBasedSourceGenerator.buildTypeDeclaration(BinaryBasedSourceGenerator.java:145)
at org.eclipse.jdt.internal.debug.eval.ast.engine.BinaryBasedSourceGenerator.buildTypeDeclaration(BinaryBasedSourceGenerator.java:160)
at org.eclipse.jdt.internal.debug.eval.ast.engine.BinaryBasedSourceGenerator.buildSource(BinaryBasedSourceGenerator.java:74)
at org.eclipse.jdt.internal.debug.eval.ast.engine.EvaluationSourceGenerator.getInstanceSourceMapper(EvaluationSourceGenerator.java:204)
at org.eclipse.jdt.internal.debug.eval.ast.engine.EvaluationSourceGenerator.getSource(EvaluationSourceGenerator.java:216)
at org.eclipse.jdt.internal.debug.eval.ast.engine.ASTEvaluationEngine.getCompiledExpression(ASTEvaluationEngine.java:226)
at org.eclipse.jdt.internal.debug.eval.ast.engine.ASTEvaluationEngine.evaluate(ASTEvaluationEngine.java:115)
at org.eclipse.jdt.internal.debug.ui.JavaWatchExpressionDelegate$EvaluationRunnable.run(JavaWatchExpressionDelegate.java:144)
at org.eclipse.jdt.internal.debug.core.model.JDIThread$ThreadJob.run(JDIThread.java:2751)
at org.eclipse.core.internal.jobs.Worker.run(Worker.开发者_开发知识库java:55)
Ok, I think I fixed it by ading an IF like so:
if (ratCast.getChildCount()>0)
imgLay.addView(ratCast);
I had the same problem, solved calling the following code on the LinearLayout that contains no child:
ll.setBaselineAligned(false);
精彩评论