[英]How to Completely Remove an Android Layout from Android Studio
I'm building an app in Android Studio and I accidentally created a base LoginActivity
template but then deleted it because I wanted to make my own.我正在 Android Studio 中构建一个应用程序,我不小心创建了一个基本的
LoginActivity
模板,但后来删除了它,因为我想自己制作。 Now, when I try creating another activity with the same name, it tells me "Layout name must be unique."现在,当我尝试创建另一个具有相同名称的活动时,它告诉我“布局名称必须是唯一的”。
I could just name it something else but:我可以将其命名为其他名称,但是:
My goal is to just remove all mentions of activity_login
, ultimately so I can make a new activity with the same name, but I can't figure out how.我的目标是删除所有提及的
activity_login
,最终我可以创建一个同名的新活动,但我不知道怎么做。
Go to res->layout->activity_login.xml
and delete it from android studio转到
res->layout->activity_login.xml
并将其从 android studio 中删除
Or open project in file explorer, then Go to app/src/main/res/layout/activity_login.xml
and delete it或者在文件资源管理器中打开项目,然后转到
app/src/main/res/layout/activity_login.xml
并删除它
If it didn't solve it, Invalidate Caches and restart Android Studio.如果它没有解决它,使缓存无效并重新启动Android Studio。
That's happens sometimes.有时会发生这种情况。 just go to :
File->Manage IDE Settings -> Restore Default Settings
.只需转到:
File->Manage IDE Settings -> Restore Default Settings
。 This will solve it for sure :)这肯定会解决它:)
I had the same problem.我有同样的问题。 Empty
res/layout/activity_xxxxx.xml
and invalidate cache didn't work, until I found there's xxxxx.java
existing in app\\src\\main\\java\\com\\example\\xxxxx
.空
res/layout/activity_xxxxx.xml
和无效缓存不起作用,直到我发现app\\src\\main\\java\\com\\example\\xxxxx
中存在xxxxx.java
。 After deleting the .java file as well, I found that I'm able to create the Activity file with the same name.删除 .java 文件后,我发现我可以创建同名的 Activity 文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.