我的logcat中有一个警告:
W/art: Verification of void com.myapp.LoginFragment$override.lambda$logIn$5(com.myapp.LoginFragment, java.lang.Throwable) took 217.578ms
Run Code Online (Sandbox Code Playgroud)
这是代码:
subscription = viewModel.logIn()
.observeOn(AndroidSchedulers.mainThread())
.subscribe(
this::showStudioSelection,
error -> {
ErrorResponse errorResponse = ErrorResponseFactory.create(error);
if (errorResponse.code() == ApiResult.BAD_REQUEST) {
Snackbar.make(getView(), R.string.login_bad_credentials, Snackbar.LENGTH_LONG)
.setAction(android.R.string.ok, v -> {})
.show();
} else {
Snackbar.make(getView(), "Unknown error " + errorResponse.code(), Snackbar.LENGTH_LONG)
.setAction(android.R.string.ok, v -> {})
.show();
}
viewModel.updateLoginButtonState();
}
);
Run Code Online (Sandbox Code Playgroud)
220ms是相当多的(我觉得我注意到片段启动时滞后).
我正在使用RxJava和retrolambda,但这不是弹出此消息的唯一地点,所以我认为它不直接相关.
我如何影响验证时间?它甚至值得吗?
它似乎与圈复杂度有关,因为我可以通过删除一些更干的代码中的Snackbar.make调用来消除警告:if
String errorMessage;
if (errorResponse.code() == ApiResult.BAD_REQUEST) {
errorMessage = getString(R.string.login_bad_credentials);
} else {
errorMessage = …Run Code Online (Sandbox Code Playgroud) 最近,当我尝试调试 android 测试仪器 APK 时,每次启动应用程序时,我都会在 logcat 中看到类似的内容
W/com.myapp: Verification of void com.myapp.test.hiptest.Actionwords.function0() took 158.211ms
W/com.myapp: Verification of void com.myapp.test.hiptest.Actionwords.function1() took 101.701ms
W/com.myapp: Verification of void com.myapp.test.hiptest.Actionwords.function2() took 110.852ms
W/com.myapp: Verification of void com.myapp.test.hiptest.Actionwords.function3() took 211.494ms
W/com.myapp: Verification of void com.myapp.test.hiptest.Actionwords.function4() took 102.497ms
W/com.myapp: Verification of void com.myapp.test.hiptest.Actionwords.function5() took 126.639ms
W/com.myapp: Verification of void com.myapp.test.hiptest.Actionwords.function6() took 138.077ms
W/com.myapp: Verification of void com.myapp.test.hiptest.Actionwords.function7() took 131.311ms
W/com.myapp: Verification of void com.myapp.test.hiptest.Actionwords.function8() took 253.859ms
W/com.myapp: Verification of void com.myapp.test.hiptest.Actionwords.function9() took 111.431ms
W/com.myapp: Verification of …Run Code Online (Sandbox Code Playgroud)