问题
How do I make sense of these errors? This is all the log cat releavant to the error. all others are GC type messages.
01-07 19:14:08.536: W/dalvikvm(5780): VFY: register2 v4-5 values 6,24
01-07 19:14:08.536: W/dalvikvm(5780): VFY: rejecting opcode 0xce at 0x004a
01-07 19:14:08.536: W/dalvikvm(5780): VFY: rejected Lnz/co/great_ape/headsup/sat_track/SGP4unit_sgp4;.sgp4 (Lnz/co/great_ape/headsup/sat_track/SGP4SatData;D[D[D)Z
01-07 19:14:08.536: W/dalvikvm(5780): Verifier rejected class Lnz/co/great_ape/headsup/sat_track/SGP4unit_sgp4;
I know the code, it's about 400 lines of sgp4 satellite tracking software
(not my code).
The problem is triggered when I create an instance of this class (it's long 400+ lines) and I have tracked the problem down to this section of code by simply commenting out all the code, then un-commenting sections until the error returns,
All the variables here are doubles. So why is android rejecting this code with opcodes for things like OP_DIV_DOUBLE and OP_DIV_DOUBLE_2ADDR
Any way, here is the section of code.
/* -------------- update for short period periodics ------------ */
if(satrec.method == 'd')
{
cosisq = cosip * cosip;
satrec.con41 = 3.0 * cosisq - 1.0;
satrec.x1mth2 = 1.0 - cosisq;
satrec.x7thm1 = 7.0 * cosisq - 1.0;
}
mrt = rl * (1.0 - 1.5 * temp2 * betal * satrec.con41) +
0.5 * temp1 * satrec.x1mth2 * cos2u;
su = su - 0.25 * temp2 * satrec.x7thm1 * sin2u;
xnode = nodep + 1.5 * temp2 * cosip * sin2u;
xinc = xincp + 1.5 * temp2 * cosip * sinip * cos2u;
mvt = rdotl - nm * temp1 * satrec.x1mth2 * sin2u / xke;
rvdot = rvdotl + nm * temp1 * (satrec.x1mth2 * cos2u +
1.5 * satrec.con41) / xke;
回答1:
Ok. It seems there was never anything wrong with the code as such, but just the length of the method and the number of variables. Declaring them outside the method solved the problem.
You can get more info here:
https://groups.google.com/forum/?fromgroups=#!topic/android-developers/lxiTkNzOvZY
来源:https://stackoverflow.com/questions/14190692/how-to-debug-dalvikvm-rejecting-opcode