Question

[Solved] Failed to find style ‘coordinatorLayoutStyle’ in current theme In Android Studio 3.1

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

Solution #1:

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'

Respondent: Ashish Kumar

Solution #2:

you can fix this issue by adding this script to the app module build.gradle, in the android section

configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
    def requested = details.requested
    if (requested.group == "com.android.support") {
        if (!requested.name.startsWith("multidex")) {
            details.useVersion "27.+"
        }
     }
   }
}
Respondent: Farhad Faghihi

Solution #3:

This appears to be a bug in the current version of Android Studio (3.1.3) as I was encountering the same thing. I downloaded the beta build from here and opened my existing project and the errors disappeared.

https://developer.android.com/studio/preview/?utm_source=android-studio

Not exactly a fix but hopefully it will get you back up and running.

Respondent: Josh

Solution #4:

Update

1. com.android.support:appcompat stable version 28.0.0 is released. So no need to downgrade version. Just use 28.0.0.

def supportVersion = "28.0.0"
implementation "com.android.support:appcompat-v7:$supportVersion"
implementation "com.android.support:design:$supportVersion"

You can ignore design library if you don’t need it.

2: You also need to update your compileSdkVersion & targetSdkVersion to remove some gradle warnings.

compileSdkVersion 28
targetSdkVersion 28

Never use alpha versions of any library, because alpha, beta and rc
versions may have bugs. And you don’t want to face these types of errors often.

Important Suggestion

I suggest you migrate to androidx because android will not update support library after 28.0.0, all updates will be available to androidx package only. Check related answer.

Respondent: Khemraj

Solution #5:

This is fixed in Android Studio 3.2.

Respondent: mhsmith

Solution #6:

Go to app/res/styles and change the Theme.AppCompat.Light.DarkActionBar for this one Base.Theme.AppCompat.Light.DarkActionBar

The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 .

Most Popular

To Top
India and Pakistan’s steroid-soaked rhetoric over Kashmir will come back to haunt them both clenbuterol australia bossier man pleads guilty for leadership role in anabolic steriod distribution conspiracy