Is Assert Reliable On Android Or Not?
Solution 1:
I think it's this difficulty getting assertions to work that the lint check is referring to. The workaround you linked to isn't officially supported, and it's recommended to use conditional checks as the lint check recommends.
The workaround to enable assertions will only work for rooted devices, and I don't know whether or not it will work on ART. There's more discussion at https://code.google.com/p/android/issues/detail?id=17324, the gist of which is that assertions were never really designed to be supported on Dalvik.
Solution 2:
Assertions are unreliable on Android. The runtime offers no reliable mechanism to enable them and the developers keep disavowing support. See issues 175697, 65183, 36786, and 17324.
To reliably use assert
statements, you would have to translate the code, e.g. before compiling it.
Post a Comment for "Is Assert Reliable On Android Or Not?"