AndroidStudio Unknown attribute(在xml中没有了代码提示)

版权声明:尊重原创,转载请附本文链接。谢谢合作! https://blog.csdn.net/DeMonliuhui/article/details/83060944

问题

在这里插入图片描述

如上图所示,编写xml的时候提示:Unknown attribute in xml and Namespace not found

真的气死人,升级到AndroidStudio3.2.1,sdk28以后问题成堆出现。

解决方案

下面是百度最多的两个解决方案,然而对我没什么用。

1.省电模式

File --->power save mode--->取消勾选

2.删除.idea和.iml,然后ReBuild

https://bbs.csdn.net/topics/391846404

Finally, deleting .idea folder and all .iml files from the project, restarting Android Studio and rebuilding gradle did the trick.
Autocomplete in XML support library is working again.
Probably checking out files from Version Control or copying all the source files in a new project would do the trick aswell.
这是stackoverflow上大神的回复,就是删除.idea文件夹和所有的.iml文件,然后重启as,重新build project,经测试时有效果的。

如果上面都不行,试试第三个,我是第三种方案解决的。

3.compileSdkVersion

就是sdk版本的问题。
https://blog.csdn.net/f327888576/article/details/51718846

我的是compileSdkVersion 28,之前一直好好的,看到这个解决办法,我改为compileSdkVersion 27,然后神奇的一幕出现了,xml里面Unknown attribute的提示消失了,然后代码提示也有了。
sdk文件损坏了???很奇怪!!!
然后我卸载sdk28,再重新安装,改回compileSdkVersion 28,就没问题了。

如下图:
先取消勾选,然后点击apply卸载。
勾选之后,点击apply就是安装。
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/DeMonliuhui/article/details/83060944