No Such Method Error Running Program After 9.20

#1

After completing the listing in 9.20, I tried running the program on a virtual device. The program would not start and displayed the following error in the Console Window:

java.lang.NoSuchMethodError: No static method getDisplay(Landroid/view/View;)Landroid/view/Display; in class Landroid/support/v4/view/ViewCompat; or its super classes (declaration of ‘android.support.v4.view.ViewCompat’ appears in /data/data/com.bignerdranch.android.criminalintent/files/instant-run/dex/slice-com.android.support-support-v4-23.4.0_e3be6ae3110650b0b0cb2c3b490b009be18a4b25-classes.dex)

I looked throughout my code and could not find any getDisplay method. Assuming this is something that Android runs in the background.

I earlier in Chapter 7 had an issue with Android not accepting the support library I imported (v4.25.0.1), which I manually changed to v4.23.4.0. I am not sure if this is the source of the error. I went back and changed the library back to v4.25.0.1, but still could not run the program.

Any help would be greatly appreciated!

#2

My best guess on that issue is the version of your support library. 25.1.0 is the latest.

Try updating to that version. If that doesn’t fix the problem, can you post the contents of your app/build.gradle file here?

#3

That appears to have worked. Thanks!