是在Android断言可用? [英] Are asserts available on Android?

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

问题描述

是在Android断言可用?我有:

Are asserts available on Android? I have:

assert(null);

它什么都不做,我在调试模式。

It does nothing and I am in the debug mode.

推荐答案

是的,他们都可用。

他们在仿真器默认情况下禁用。您需要将 -shell -prop Debug.Assert的= 1 命令行参数添加到其他仿真器的命令行选项,在您使用运行你的应用程序的运行配置。

They are disabled in emulator by default. You will need to add -shell -prop debug.assert=1 command line parameters to Additional Emulator Command Line Options at the run configuration you're using to run your app.

其他的事情你应该知道的是,安装在设备上的应用程序将不考虑断言 - 它们将被忽略

The other thing you should be aware of is that your application installed on a device will not take into account assertions - they will be ignored.

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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆