Cha*_*kti 14 java android android-layout android-studio android-layout-editor
Android Studio 3.1布局预览无法在当前主题中找到样式"coordinatorLayoutStyle".
Failed to instantiated one or more classes.
Exception shown are :-
java.lang.ClassNotFoundException: android.view.View$OnUnhandledKeyEventListener
Run Code Online (Sandbox Code Playgroud)
小智 17
这是因为使用了alpha版SDK 28
我们需要改变android { ... }的"的build.gradle"在应用程序文件
compileSdkVersion 28,以compileSdkVersion 27
targetSdkVersion 28对targetSdkVersion 27
此外,尝试更改类似的
implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'实现
implementation 'com.android.support:appcompat-v7:27.1.1'
希望这个有效!
对于Android Studio v3.1.*,我们还需要更改:
implementation 'com.android.support:design:28.0.0-alpha3'to
implementation 'com.android.support:design:27.1.1'
您可以通过build.gradle在此android部分中将此脚本添加到应用程序模块来解决此问题
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == "com.android.support") {
if (!requested.name.startsWith("multidex")) {
details.useVersion "27.+"
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
小智 -1
转到 app/res/styles 并更改 Base.Theme.AppCompat.Light.DarkActionBar 的 Theme.AppCompat.Light.DarkActionBar
| 归档时间: |
|
| 查看次数: |
8372 次 |
| 最近记录: |