导入android项目后不自动生成R.java文件的解决方法

1、Project > clean 一下项目。(一般都ok了,不行的话看2)
2、确保AndroidManifest.xml文件无错误是否引用了不存在的值。(不行的话看3)
3、看看values 文件夹的配置文件是否引用了你现在SDK没有的属性。(不行的话看4)
4、新建一个项目把你要导入的项目拷贝到新项目。(不行的话看1) 
例如下面的错误:
<style name="CustomWindowTitleBackground" parent="android:WindowTitleBackground">  
<style name="CustomWindowTitle" parent="android:WindowTitle">  
错误提示:error: Error retrieving parent for item: No resource found that matches the given name 'android:WindowTitleBackground'
错误提示:error: Error retrieving parent for item: No resource found that matches the given name 'android:WindowTitle'
 
改为如下解决
<style name="CustomWindowTitleBackground" parent="*android:WindowTitleBackground">
<style name="CustomWindowTitle" parent="*android:WindowTitle">
 
原文地址:https://www.cnblogs.com/yuzhoulangzi/p/lcj.html