I have created the android application project but if i try to save the "activity_main.xml" it is saying that.
Message
The original file 'activity_main.xml' has been deleted or is not accessible.
If I click ok it is trying to replace the xml. But it did not happen before. I am using eclipse.
If I create any other activity and try to save that xml then it is working fine. This error is happening only for launcher activity with the project name FCI.
It works fine if I change the project name.
This issue occurs to me every time I delete a project from a workspace, and then import one with the same name from another location. (Using eclipse Kepler sr 2)
I guess eclipse caches the workspace session metadata, but doesn't update it on such overwrites.
Restarting the workbench solves this problem every time.
Please try to restart your eclipse... I hope it would work for you
Related
i have created 4 activities they all were work well but suddenly the preview of design in XML file is not showing I have tried to reopen my android studio also that specific XML. but the problem is still here.
XML code is showing but only the preview of design is not showing here the ss of screen.
please check and help me to solve this out.
please try the following steps:
clean project
delete .idea and .gradle file
remove app/build folder
now do invalid cache and restart
if still your problem is not solved then try to restart your computer
you just need to do invalidate Caches and restart, I have provided an image for you to know what to do exactly. in android studio, go to the top left corner and select file and click on Invalidate Caches/restart and that will restart your android studio. than try to open your xml layout.
Image
This is a log on StackOverFlow for those who continue to have problems after doing a clean build, invalidating caches and restarting, and restarting the computer.
Check if the element of the view has a custom view imported from an external library.
Ex.
In my case, I was using YouTubePlayerView of YouTubeAPI.
Obviously, the preview worked fine until Chipmunk.
However, the preview has not been released since Dolphin.
So I annotated the YouTube player view.
Then the preview was displayed normally.
In fact, I've confirmed that other people are experiencing the same problem as above.
So my guess is that custom views from libraries that are no longer updated as Gradle versions go up are not compatible with each other.
In that case
It seems to be a problem caused by using an external library view called de.hdodenhof.
enter image description here
While adding a feature to my app I messed up and decided to delete all the new files I had added for it but in doing that I accidentally deleted one of the activity from my app. I have integrated version control in my app and also shared my whole app source with GitHub but for some reason whenever I check out of previous version controls I cannot find the file. How can I recover the activity.java file? I have the app installed on my phone. Is it possible to recover it from there? or any other way to recover it?
If Ctrl + z or version control didnt worked try to check the local history of the android studio:
Move to project structure -> right click on your app name -> local history -> show history
Click on your package and do Ctrl+z and then undo changes.
My computer crashed while I was working on the project.
My mainActivity.java has no code inside there now.
I have tried going to
I:\Users\myUsername.AndroidStudio2.1\system\LocalHistory but I don't see the file there.
Open MainActivity.java in Android Studio, right click inside the file and go for LocalHisoty > Show History. Let me know if it works, please. Cheers
You can use your last debug version of application and decode it,you can find it in \app\build\outputs\apk folder
I've googled for the answer and read many forums and stackoverflow threads but I still can't get it to work.
I just started trying to develop my first Android app, and after following the instructions listed on the website, when I started the project, it opened with two tabs, one showing a java file, and the other showing an xml file. The tab with the xml file also had this simulation of an android phone on it where I could play around with the GUI.
When I stopped working on it, I closed all the tabs and closed eclipse, but now I want to work on it again and I don't know how to get it back to the setup showing the java and the xml file with the little simulation. I don't even know where the activity_main.xml is located.
I don't want to create a brand new project.
I tried importing a project, but the finish button is always grayed out or it wont let me import because it says that a project already exists in the workspace, or after I click on the folder containing all the bin, res, src, etc. files, and I click OK to import it, nothing happens.
Is it possible to just click on a single file, like the .sln file in visual studio, that will automatically launch eclipse with your project ready to go?
The activity_main.xml is located in your_project/res/layout.
Just open Eclipse and navigate to this directory in Package Explorer window:
When you double click the activity_main.xml you should see the XML and Graphical Layout tabs at the bottom.
Here is a description of android project structure:
http://developer.android.com/tools/projects/index.html#ApplicationModules
Make sure you uncheck the copy attribute when you import the project, this solve the project is already exit problem, and you can try both Existing Project Into Workspace and Existing Android Code Into Workspace.
The layout file lay in project_name/res/layout.
Source file lay in project_name/src.
You can double click to open your files, and your files remain open the next time you open eclipse, only if you don't close them when you exit the eclipse.
There are a few ways to reopen your project again:
Try to open the project explorer:
-> Window -> View -> Project Explorer -> Hit refresh
Open your .project file (in your workspace) an edit the name in the xml name tag and try do import again.
Please make a backup before.
I just started working with Android apps and was trying few sample programs. I noticed an issue with the main.xml file. It happened twice today, I added few new layout views in main.xml (Using Layout and XML both), as soon as I made a modification and tried running the program, the R.java class would throw an error, also a new file called main.out.xml is getting created automatically. On top of this, when I am trying to "clean" the project, it deletes the R.java file altogether. Why is it acting this way?
This is a bug in the eclipse IDE relating to android development. I had the same problem when I first started. You need to make sure that the file that is currently being edited (i.e. active in the editor) is a java source file when you try to run the project. If any other file is active, such as your main.xml file then it ends up creating this main.out.xml that is a garbage file. To fix, just delete the garbage main.out.xml and make sure a java file is active and hit run and you are back to normal.
Try deleting that tmp file and re-cleaning the project