Reputation: 574
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. 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.
Upvotes: 2
Views: 1877
Reputation: 77
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
. After deleting the .java file as well, I found that I'm able to create the Activity file with the same name.
Upvotes: 0
Reputation: 41
That's happens sometimes.
just go to : File->Manage IDE Settings -> Restore Default Settings
.
This will solve it for sure :)
Upvotes: 0
Reputation: 4442
Go to res->layout->activity_login.xml
and delete it from android studio
Or open project in file explorer, then Go to app/src/main/res/layout/activity_login.xml
and delete it
If it didn't solve it, Invalidate Caches and restart Android Studio.
Upvotes: 7