前言:这学期开始上手安卓了,在学习的过程中遇到了许多问题,有的问题已经解决了,有的问题尚未找到解决方案。今天我来把一些问题做一个总结。
1.新建的工程无法预览布局文件,并且报错:
The following classes could not be found:
android.support.v7.internal.widget.ActionBarOverlayLayout (Fix Build Path, Create Class)
解决方法一:1) Tools->Android->Sync Project with Cradle Files
2) Layout Editor上方找到Refresh按钮,点击刷新,Done
解决方法二:在styles.xml中 的Theme.AppCompat.Light.DarkActionBar前面加上Base
<!-- Base application theme. -->
<style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
</style>
像这样
2.报错:Cannot resolve symbol 'R’
解决方案:点击File->Invalidate Caches / Restart->Invalidate and Restart
3.打包apk时报错:Execution failed for task’:app:mergeReleaseResources