“无效的符号名称"Android Studio崩溃后 [英] "invalid symbol name" after Android Studio crashed

查看:98
本文介绍了“无效的符号名称"Android Studio崩溃后的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Android Studio中编辑布局,并添加了一个Switch.我首先将其ID设置为"switch".发生编译错误后,我意识到这是一个保留关键字,无法使用,因此我决定将其ID更改为"mySwitch",但此时Android Studio崩溃了.

I was editing a layout in Android Studio and added a Switch. I first set its ID to "switch". After a compilation error, I realized it was a reserved keyword and I cannot use it, so I decided to change its ID to "mySwitch" but Android Studio crashed at this moment.

再次启动它后,我检查了ID,该ID确实已更改为"mySwitch",但是在尝试编译时,仍然出现此错误:

After launching it again, I checked the ID, which does have been changed to "mySwitch", but when trying to compile, I still get this error:

/path/to/app/build/generated/source/r/debug/com/example/program/R.java: error: invalid symbol name 'com.example.program:id/switch'.

我猜想Android Studio在崩溃前并没有更改"switch"的所有出现,但我没有发现任何变化.

I guess Android Studio did not change all occurences of "switch" before crashing, but I did not find any.

我尝试了但没用的东西:

What I tried but did not work :

  • 再次更改ID
  • 删除并再次添加Switch
  • 清洁项目

我没有想到的我的Switch ID是否发生了?

Is there any occurence of my Switch ID I did not think of ?

推荐答案

我发现了问题,我应该早点想到的.
我所做的是右键单击"my_layout.xml" > 分析> 检查代码...

I found the problem, I should have thought of that earlier.
What I did is right click on "my_layout.xml" > Analyze > Inspect Code...

然后它向我显示了这一行

Then it showed me this line

app:layout_constraintEnd_toStartOf="@+id/switch"

我不知道我怎么想念...

I don't know how I missed that...

这篇关于“无效的符号名称"Android Studio崩溃后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆