1

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:

  1. Enabled and disabled in runtime using:

    adb shell setprop debug.assert 1 (or 0)

  2. comparing to some public static myAssert(boolean condition,String message) - myAssert executes/evaluates the message in any case, while assert does so only if the condition is false. So myAssert(..) is expensive in cpu and memory, especially if you need meaningful messages such as Arrays.toString(..). And you'll need to skip any myAssert call if you're doing profiling.

Amir Uval
  • 14,425
  • 4
  • 50
  • 74

1 Answers1

0

Google says assert was never officially supported, and now it is not even there.
RIP.

Amir Uval
  • 14,425
  • 4
  • 50
  • 74