Failed to find style 'coordinatorLayoutStyle' in current theme In Android Studio 3.1

Chanchal Shakti picture Chanchal Shakti · Jun 14, 2018 · Viewed 8.6k times · Source

The Android Studio 3.1 layout preview fails to find style 'coordinatorLayoutStyle' in the current theme.

Failed to instantiated one or more classes.
 Exception shown are :-
java.lang.ClassNotFoundException: android.view.View$OnUnhandledKeyEventListener

Answer

Ashish Kumar picture Ashish Kumar · Jul 7, 2018

This happened due to use of alpha version SDK 28

We need to change the android { ... } in "build.gradle" in app file
compileSdkVersion 28 to compileSdkVersion 27
targetSdkVersion 28 to targetSdkVersion 27

Also, try to change implementations like
implementation 'com.android.support:appcompat-v7:28.0.0-alpha3' to
implementation 'com.android.support:appcompat-v7:27.1.1'

Hope this works!

For Android Studio v3.1.*, in addition we need change:
implementation 'com.android.support:design:28.0.0-alpha3' to
implementation 'com.android.support:design:27.1.1'