No Such Method Error Running Program After 9.20


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 ‘’ appears in /data/data/

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!


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?


That appears to have worked. Thanks!