How to Completely Remove an Android Layout from Android Studio - android

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:
I don't want to
There would still be some sort of duplicate files in my system doing nothing
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.

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.

That's happens sometimes.
just go to : 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. After deleting the .java file as well, I found that I'm able to create the Activity file with the same name.

Related

How to restore a deleted RunConfiguration in Android Studio?

I was trying to deal with a testing-related problem and I followed this advice:
https://stackoverflow.com/a/32267762/2576903
Now whenever I try to run my tests, I get prompted to choose a device.
How do I restore that build configuration?
I tried git commit to see changed files, but it seems that it was somewhere outside of the project folder. I also tried invalidating android studio's caches but nothing seems to work.
I tried creating another test class automatically (by control + enter on the name of a regular POJO) but the configuration wasnt created.
Went to the folder of my current test class,
created a new class
inserted annotation #RunWith(MockitoJUnitTestRunner.class)
right clicked the newly created class' name -> Run
and it created the configuration.

Android studio does not create files

I added a new fragment to my project in Android studio like the way I did it a couple of times before, but now it says that this file das not exist (and is read only). I cannot edit a thing in it but also do not know how to correctly close it, so I can't use the name, which I really want...
I cannot find the file anywhere within my project and it is also not listed in the project+path (Name/App/src/main/...) but in the entire windows location (E:/...).
And how can I create a permanent file, or better, why does it not work any more?
This must be a fault on your side. Are you sure you are in the right folder? This is the only explanation I could think of. So you creat the files but outside of your project's folder, so you cannnot edit them or anything else, but read them...
Bene
Make sure that you have no LINT ERRORS.
For checking it:
Go to the bottom right side of Android Studio. Tap on "Gradle Console" tab.
If you have some errors(red text) - remove them and try again.

Eclipse can see resources which do not exist

I am new to Android development.
I created an Android project, and imported some images as resources.
Unfortunately, one of them contained a capital letter, which is illegal. I have first renamed, then removed the offending image. Then I delete all images, but Eclipse still insists they are there after clicking refresh refreshing and running clean several times.
Could anyone tell me how to fix this?
If the file actually exists in your workspace . Just Right Click the file and select Validate . It should be alright

Problem facing while accessing already created project into the workspace

This is the problem am facing since many days. am trying to manage that but not able to solve that. while am try to access the project which is existing project into workspace then am getting some kind of error at the "#override" tag and when remove that the error disappear and single error will be shown at the application name and that cannot be removed. Am doing for the mean while is try to copy all the code from the each java file and paste it to another project that was created newly.
Can any one help me in this concern. Thanks in advance.
Your problem is related to JDK for this what you have to do is from menu options choose
Window > Preference then navigate to node displayed in below image and set "Compiler compliance level as 1.6"

Cannot find the culprit file in my android project even after expanding the main folder

The side bar in eclipse shows a red cross on the title of my project folder but there are no such signs in the directories below it in hierarchy. In which particular file does error exist? How can I know that?
Error log shows: Current file is not a match for the given config.
Sorry I just came across this now, but I've had the same error too, so I'm sure others have. There was a quite a bit easier solution than what you had to do, at least in my case. I had the exact same problem, where my main project said there was an error, so I couldn't debug or run, but there was no apparent error, other than the red X on my main folder.
In order to solve this, I simply closed the project by right-clicking on the main folder, and selected "Close Project". Then, I right-clicked on the closed project, and selected "Delete". Don't worry, this will not delete any files, it will only remove it from the workspace, and will make sure you really want to do that by asking you to confirm. Now, just click on File->Import and select "Existing Projects into Workspace". Choose your parent folder for your app that was erroring, and import it. The few times I've had the phantom error on my main app, this has fixed it each time.
Whether there is an underlying cause and this process simply refreshes something in the workspace, I'm not sure, but at this point this fix is fast enough for me to use it.
Hope this helps next time!
Project -> Clean
Closing project and opening it again fixed it for me.
formed a new workspace and formed a new project. Added each file individually. Now it shows no error.. but still can't figure out what was wrong with thr previous code..? :=(
I faced the same issue..
there was a problem in manifest xml..
the path was not set properly. there may be space in the path..
I just copied the activity tag from other project and pasted in my project and just edited the path in android:name. it worked fine..

Categories

Resources