Android studio keeps reverting to an older copy of XML - android

I was making changes in one of the xml files in my Android Studio project on Windows 10 then this after clicking Ctrl + s by mistake, it never saves the current file and then I receive this error:
Following errors occurred on attempt to save files: Cannot save blabla.xml. Unable to open the file for writing.
This window keeps appearing prior to building:

Copy content of xml, save to place outside of android
studio
Delete file from android studio
Create new file with same name
Copy saved content to new xml.
This fixed my problem invalidate/restart didn't worked.

Related

There is any issue if my widget_test.dart file under test directory showing error?

This image showing my widget_test.dart file. During moving a file from my recent project to a new one these errors occur.But my project running smoothly. I want to ask if delete this file or remains the same as errors there is any issue occurred in the future in this project?
You can delete that file. It is a file default test file created by flutter for testing purpose. but you can create another one in future ,if you want to perform tests on your code.

Layout resource files not recognized

I refactored a resource_layout file but android studio didn't recognize the change so I deleted the file but didn't check the safe delete boxes.
Now whenever I create any layout resource files they are not recognized in my project. Any help would be very appreciated!
Also, the old layout resource file I had deleted is still recognized in my code (even though it should be breaking).
I tried cleaning my project, rebuilding my project, making my project.
I also tried checking through the terminal to see if the original layout resource file I deleted was still somewhere in the project but it isn't.
MaterialEditText edit_name =(MaterialEditText)enter_name_view.findViewById(R.id.edit_name);
The enter_name_view doesn't exist anywhere but this line doesn't show any errors.

Android Studio Open Wrong File When Trying to Open XML layout file [duplicate]

This question already has answers here:
Android Studio shows wrong file contents
(10 answers)
Closed 4 years ago.
I am using android studio 3.3, my project is using kotlin 1.3.20 with build gradle 3.3.0
however when i try to open xml file, it open different file with the right file name and the right file path:
And when i try to see this xml file in my Git, my file is normal
when i try to run this project, it run with no problem at all.
i already try to invalidate caches/restart but the problem still exist.
this error affecting random xml files. some of my xml layout files open my kotlin file. some of them open auto generated file
please help.... is this something to do with error indexing? how can i fix this?
UPDATE :
found someone who might have the same problem with this, in google issue tracker : https://issuetracker.google.com/issues/122988154
UPDATE 2 :
this issue is not just happen in xml file but also in kotlin file.
i try to open my activity file, but it open one of data binding generated classes
So Apparently this issue is bug in Android Studio. after do some research, this bug might be happen not just to xml layout but other xml file too such as resource like dimens, strings, style etc..
finally there is some workaround for this issue that work without reinstall Android Studio.
Thank you #ChetanJoshi for the suggestion in the comment section.
Steps:
Copy the error xml file to somewhere in your PC directory (as backup file)
Delete the error xml file, if there is dialog file usage appear klik delete anyway
Copy the backup file and paste it back to where it was deleted
Run your project. it should run
If you are using Data Binding and there is error appear about auto generated data binding
class, Clean Project then rebuild project. if the error still appear try to invalidate caches/restart, rebuild project then run the project
Restart your Android Studio, if not working, Restart your PC.
or
Go to plugins -> Android support and disable this. Restart Android studio and enable the plugin again
After that don't forget to Refresh your Gradle project.

Failed to create parent directory when I start a new project?

I tried each and everything possible like updating my Android Studio, enable gradle in offline mode, in fact I reinstalled Android Studio two times at different location but nothing is working, every time getting the same error:
Error:Failed to create parent directory 'C:\Users\professional.gradle\caches\modules-2\files-2.1\com.google\google\1' when creating directory 'C:\Users\professional.gradle\caches\modules-2\files- 2.1\com.google\google\1\c35a5268151b7a1bbb77f7ee94a950f00e32db61'
The error is solved after deleting the complete activity file and XML file in it, creating a new activity and then just cleaning and rebuilding your project will resolve the error and run the app.

Eclipse Android XML Editor Error:The file dose not exist

I have been working on Eclipse classic last version to develop an Android Application and just now it craches and I can't view or write any xml file.
The error appears while openning the Eclipse is as follow:
Android XML Editor Error:The file dose not exist
here are snapshots of my errors:
thank you,
I had a similar problem and solved it by taking following steps
1) Opened a project whose XML file was working correctly.
2) Closed the XML files which were getting error of the previous project.
3) Restarted the Eclipse.
I got this error when I got power failure at my home and don't know what this error means but I fix it this way.
I replaced eclipse main folder with original downloaded and it worked for me.
When you open eclipse you will see 3 or 4 .xml files already opened like string.xml etc... close all these files and close your eclipse. Again open eclipse and you will not see this error again.
please Close all the xml files and restart your Eclipse SDK it will solve when the workspace have the more metadata and plugins than you have this type of the error but the easy solution is that you have to close all xml and just restart your SDK

Categories

Resources