主题错误 – 如何解决?

尝试了许多解决方案,但没有帮助

参考: 在当前主题中找不到样式’coordinatorLayoutStyle’失败

但没有帮助

渲染问题:

无法在当前主题中找到样式’coordinatorLayoutStyle’

提示:尝试刷新布局。

我的项目的build.gradle文件是:

buildscript { repositories { google() jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.1.4' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { google() jcenter() } } task clean(type: Delete) { delete rootProject.buildDir } 

模块:应用

 apply plugin: 'com.android.application' android { compileSdkVersion 28 defaultConfig { applicationId "*****" minSdkVersion 19 targetSdkVersion 28 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'com.android.support:appcompat-v7:28.0.0-alpha1' implementation 'com.android.support.constraint:constraint-layout:1.1.2' testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.2' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' implementation 'com.android.support:design:28.0.0-alpha1' } 

主要活动XML代码

       

为什么我没有更改已编译的SDK版本28到27 bcz我想使用底部应用栏

底部应用程序栏材料设计

App Bars:底部材料设计

主要活动Xml

这是28.0.0中的一个错误,唯一的修复(解决方法)是将其添加到Build.gradle

 configurations.all { resolutionStrategy.eachDependency { DependencyResolveDetails details -> def requested = details.requested if (requested.group == "com.android.support") { if (!requested.name.startsWith("multidex")) { details.useVersion "27.1.1" } } } } 

以某种方式,这绕过了问题并使用27支持库。 否则,您可能希望将Android Studio更新为canary通道版本或使用27.1.1等后向支持库。

您的渲染布局中出现此错误,这是Studio Not在任何文件或库中的一部分

  1. 尝试在styles.xml中的T​​heme之前添加“Base”,如下所示: – “Base.Theme.AppCompat.Light.DarkActionBar”

  2. 请通过选择菜单选项“文件”→“使缓存无效/重新启动”重新启动Android Studio

  3. 解决方法:尝试使用AS v1.3预览进行M预览渲染或使用FrameLayout进行设计,并在调试时更改为android.support.design.widget.CoordinatorLayout。

我对28.0.0-alpha1也有同样的问题

你可以将它改为27,直到它被修复。
要么
2.将

更改为


请注意Base。
要么
3.在预览选项卡中,将主题更改为“Materiar.Light.NoActionBar”。 其他一些主题也有效,但我只记得这个。