android:关于Error:(4, 5) Error retrieving parent for item: No resource found that matches ...问题的解决方案

问题:使用AS 启动项目进行编译的时候,控制台输出报错:
android:关于Error:(4, 5) Error retrieving parent for item: No resource found that matches ...问题的解决方案
定位到报错的位置:
android:关于Error:(4, 5) Error retrieving parent for item: No resource found that matches ...问题的解决方案

异常分析:根据字面意思,缺少与styles文件中的“ThemeAppCompat.Light.DarkActionBar”相匹配的资源文件,而ThemeAppCompat.Light.DarkActionBar为API 26 的描述,而对应的找到gradle文件中的compileSdkVersion 版本,发现版本为23,这就是问题的所在。

解决方案:
方案1:尝试将compileSdkVersion设为23(如果sdk里面没有下载API 23的,则需要下载),在snyc 同步,问题解决!

方案2:如果不想下载API 23怎么解决呢?升高appcompat的版本:将build.gradle里面的dependencies对应的appcompat版本升高:
android:关于Error:(4, 5) Error retrieving parent for item: No resource found that matches ...问题的解决方案
将compile ‘com.android.support:appcompat-v7:23.0.1’的版本改为:’com.android.support:appcompat-v7:26.1.0’