1

Are the code assertions really run in Android for the release builds? Assertion failures are not reported by my code. It leads to crashes. Is there a way to turn on Assertions for release mode?

ssk
  • 9,045
  • 26
  • 96
  • 169
  • Assertions are used to find programming errors. They are not* part of the logic of a program. The an assertion failed, you "failed at programming" … ;-) (* read = _must not be_) – Kijewski Jul 17 '12 at 21:51

2 Answers2

0

Even on Java assert is only for debug purpose, not being guaranteed to work on releases.

Kijewski
  • 25,517
  • 12
  • 101
  • 143
Pozzo Apps
  • 1,859
  • 2
  • 22
  • 32
0

I think using junit.framework.Assert instead of the Java assert keyword (which gets stripped by Dalvik) should do the trick.

If you insist on using the assert keyword, there are various workarounds.

Community
  • 1
  • 1
David Titarenco
  • 32,662
  • 13
  • 66
  • 111