本文介绍了被断言可靠Android或不?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有这个问题,答案是:

Can我主张用在Android设备上?

不过,后来我碰到这个跑:

它说:

There is no "assertion" keyword, there is only an "assert" keyword, so I'm not sure what to even make of that release note.

Anyway, what I'm curious about is:

If I follow the first link and do:

adb shell setprop debug.assert 1

before installing the app on the device, and compile the app as debug with assertions turned on, then are they reliably expected to work on all devices? Or, should I believe the release notes for Android Studio 0.4.5?

解决方案

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.

这篇关于被断言可靠Android或不?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-22 18:56
查看更多