Android 我的风格怎么了?无法解析符号Theme.AppCompat.Light.NoActionBar
当前,my styles.xml文件显示了一些不正确的内容<无法解析代码>主题.AppCompat.Light.NoActionBar。我重新启动了android studio,但它仍然不工作。我尝试了使缓存无效/重新启动,但无效。它不会使我的应用程序崩溃,但它为什么会发生。请看下图: 这是我的build.gradle文件Android 我的风格怎么了?无法解析符号Theme.AppCompat.Light.NoActionBar,android,android-studio,android-appcompat,android-styles,Android,Android Studio,Android Appcompat,Android Styles,当前,my styles.xml文件显示了一些不正确的内容主题.AppCompat.Light.NoActionBar。我重新启动了android studio,但它仍然不工作。我尝试了使缓存无效/重新启动,但无效。它不会使我的应用程序崩溃,但它为什么会发生。请看下图: 这是我的build.gradle文件 import org.apache.tools.ant.taskdefs.condition.Os apply plugin: 'com.android.application' app
import org.apache.tools.ant.taskdefs.condition.Os
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 23
buildToolsVersion '25.0.0'
defaultConfig {
applicationId "xx.com.xxx.xxxx"
minSdkVersion 17
targetSdkVersion 23
versionCode 21
versionName "1.2.0"
renderscriptTargetApi 23
renderscriptSupportModeEnabled true
// Enabling multidex support.
multiDexEnabled true
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile('com.afollestad.material-dialogs:core:0.8.5.1@aar') {
transitive = true
}
compile('com.mikepenz:actionitembadge:3.0.2@aar') {
transitive = true
}
compile project(':blurringview')
compile 'com.android.support:support-v4:23.3.0'
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support:design:23.3.0'
compile 'com.android.support:cardview-v7:23.3.0'
compile 'com.android.support:recyclerview-v7:23.3.0'
compile 'com.google.android.gms:play-services-gcm:8.3.0'
compile 'com.android.support:palette-v7:23.3.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.wdullaer:materialdatetimepicker:1.5.1'
compile 'com.pnikosis:materialish-progress:1.5'
compile 'com.mikepenz:iconics:1.3.0@aar'
compile 'com.mikepenz.iconics:community-material-typeface:+@aar'
compile 'com.soundcloud.android:android-crop:1.0.0@aar'
compile 'org.apache.commons:commons-lang3:3.4'
...
}
...
}
最后,这是我的第一个解决方案。发生此错误的原因是gradle无法使用版本较低的库。它不编译外部库appcompat-v7:23.3.0。我现在要做的是将gradle插件frorm 2.+降级到2.2.0,然后重建项目。现在又能用了 此链接显示如何降级版本gradle 这不是一个好主意,心想,但它确实解决了我的问题 欢迎提出任何其他需要改进的想法或意见
你能在这里显示build.gradle文件吗?我想你忘了在build.gradle中添加:compile'com.android.support:appcompat-v7:XX.XX.XX'。请注意以下版本信息:No@David。我有。这是我的build.gradle文件中的
编译'com.android.support:appcompat-v7:23.3.0'
,很抱歉错误的指向。。。您是否已经尝试清理您的项目?请展示你的版本。gradle文件谢谢,这帮我解决了问题。基本上,当Android Studio试图强迫你升级时,你永远不应该接受gradle升级,这样你就不会有那么多谷歌问题了。遗憾的是,他们编程如此糟糕,不再测试任何东西。我从来没有真正升级过gradle,但没有介绍bugsI在升级gradle 3.1.2后也面临同样的问题,在按照建议重新导入后,它工作正常。你救了我一天。