问题描述
Android Studio 3.1 布局预览在当前主题中找不到样式coordinatorLayoutStyle".
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
推荐答案
这是由于使用了 alpha 版本 SDK 28
我们需要更改应用文件中build.gradle"中的android { ... }
compileSdkVersion 28
到 compileSdkVersion 27
targetSdkVersion 28
到 targetSdkVersion 27
We need to change the android { ... }
in "build.gradle" in app filecompileSdkVersion 28
to compileSdkVersion 27
targetSdkVersion 28
to targetSdkVersion 27
此外,尝试更改实现,例如实现'com.android.support:appcompat-v7:28.0.0-alpha3'
到实现'com.android.support:appcompat-v7:27.1.1'
Also, try to change implementations likeimplementation 'com.android.support:appcompat-v7:28.0.0-alpha3'
toimplementation 'com.android.support:appcompat-v7:27.1.1'
希望这有效!
对于 Android Studio v3.1.*,我们还需要更改:实现 'com.android.support:design:28.0.0-alpha3'
到实现'com.android.support:design:27.1.1'
For Android Studio v3.1.*, in addition we need change:implementation 'com.android.support:design:28.0.0-alpha3'
toimplementation 'com.android.support:design:27.1.1'
这篇关于无法在当前主题中找到样式“coordinatorLayoutStyle"在 Android Studio 3.1 中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!