Previewing layout (fig 1.12) in 3rd Edition of book, not working

I get errors highlighted on both “<Button” lines in my first xml layout file from ch1 of the textbook. Was “Button” deprecated or something? what should i do please? The “Alt+Enter” genie suggests two options: override resource in other configuration…, OR, annotate class Button as @deprecated

Specifically the problem is being talked about here as well:

I’m having the same problem the original poster asked at stackoverflow. Any solutions?

Hello @kiers,
If you are not able to view layout in your preview window , you can follow the same solution as given on stack overflow.
This happens because when you create a new project, appcompat library dependency is added by Android Studio itself and targetSDK 28 appcompat library is creating issues with previewing the design, if you change the mentioned 28 API with 27 , then preview window will display your layout or else change the theme if you want to use API 28.

Let me know if that works for you.

Best,

Ok digging around stackoverflow showed me that even leaving sdk28 alone is oK. I just updated my IDE to Android Studio 3.2 (looong download process) and it all works as expected! But for the future i have my eye on that App Theme menu item in the preview window! thanx.

1 Like