My code uses assert
calls extensively.
After updating to 5.1.1 (tested on Nexus 4 & Nexus 5), the assertion calls are being ignored. Selecting "debug app" under Developer options made no difference.
Had anyone solve this issue? (Before I'm forced to replace all the assertions with some myAssert(..)
).
Update:
The issue I've opened was closed with this comment:
debug.assert was never implemented.
It appears there is not much demand for this tool, beats me.
assert
was an extremely powerful tool.
Some advantages:
Enabled and disabled in runtime using:
adb shell setprop debug.assert 1 (or 0)
comparing to some
public static myAssert(boolean condition,String message)
- myAssert executes/evaluates themessage
in any case, whileassert
does so only if thecondition
is false. SomyAssert(..)
is expensive in cpu and memory, especially if you need meaningful messages such asArrays.toString(..)
. And you'll need to skip anymyAssert
call if you're doing profiling.