Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Art: Verification of X took Y ms

Tags:

I've got a warning in my logcat:

W/art: Verification of void com.myapp.LoginFragment$override.lambda$logIn$5(com.myapp.LoginFragment, java.lang.Throwable) took 217.578ms 

Here's the code:

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();                  }             ); 

220ms is quite a lot (and I feel like I'm noticing a lag on startup of that Fragment).

I'm using RxJava and retrolambda, but this is not the only spot where this message pops up so I don't think it's directly related.

How can I influence the verification time? Is it even worth it?

It seems like it has something to do with cyclomatic complexity, since I could get rid of the waring by removing the Snackbar.make calls in the if with some more dry code:

String errorMessage; if (errorResponse.code() == ApiResult.BAD_REQUEST) {     errorMessage = getString(R.string.login_bad_credentials); } else {     errorMessage = "Unknown error " + errorResponse.code(); } 
like image 946
Lovis Avatar asked May 03 '16 14:05

Lovis


1 Answers

For anyone in year 2020 and beyond looking for the solution -- Android 11 has the following setting in the Developer options:

enter image description here

It's ON by default. Turn it OFF to get rid of the annoying delays every time app is launched when debugging.

like image 152
user4698855 Avatar answered Oct 01 '22 03:10

user4698855