I was working on a project. I deleted the project from the workspace (not from disk) temporarily to work on another project. I'm sure that I had saved my work before doing this. After finishing with second project I deleted it from workspace and imported the first project but there was nothing of my codes. Everything was removed. the files (classes, layouts, etc) all of them were in the project but they were empty. I checked the files on the disk and unfortunately saw that what is inside eclipse is real! All the files were empty and all my codes gone. I wanna ask WHY should this happen?
It happens to me also. You have to make a copy of your project on your disk first. Then you open it with eclipse and click to "copy projects into workspace" and then it works :)
Say if it's ok !
Related
I'm running Android Studio 3.1.1 on OSx and I have three projects that all use the same local library projects / modules.
My problem is that Android Studio often opens the wrong project when I open one of those 3 projects. Let's say I open Project 2 or Project 3, then I might find that Project 1 is the project that is actually opened, even though it displays the correct path for all three in the "Welcome to Android Studio" dialog.
The solution I've been resorting to until now is to
Remove all three projects from the "Welcome to Android Studio" dialog project list
Go into all three project folders, removing the .iml file
Importing the projects back into Android Studio using the "Import project" function
I'm getting really tired of this, and it's really confusing to think that you have opened one project but another one opens instead.
What could be causing this very strange behaviour?
Sometime android_studio is catching the old cache, to solve this go file , hit invalidate cache and restart. And the second solution is, you have to Refactor the package name, every project should have the unique package name in this situation. i hope this will help...
https://developers.google.com/android/guides/google-services-plugin
go to this official link. It solved me this problem. In my case, ] deleted saved file in this path "app/build/generated/res/google-services/{build_type}/values/values.xml" which contains my previous app's information. After that, when I run my current app, it created that file again, but with my current app's info.
I have been studying Android on Eclipse Mars for some time and i have been facing a constant problem everyday-the changes made in a folder/file are not recognized by some other folder/file. For example, if i create a new layout in the layout folder and then use it in the setContentView, it shows me an error ("layout-name cannot be resolved or is not a field). It works if i save the project,close it, and open it again, but this takes up a lot of time if i have more than one error, so the question-is there a way to save and refresh the project (without having to close it) so that the newly made files and folders are recognized by the java files?
Thank you.
You can refresh your project in Eclipse by right clicking on the project root folder in your Project Explorer and selecting "Refresh".
You may also want to consider checking if you have "auto build project" turned on. In your top toolbar go to Project -> Build Automatically.
If build automatically is turned off you will have to manually build your project, by Right Clicking on the project in your Project Explorer and selecting "Build Project".
However, I do agree with Pankaj Nimgade that Android Studio is likely a better entry point IDE for Android development.
Real advice: Switch to Android Studio as soon as you can. There you would sometimes have another problem called "sync" though. But it's a much better IDE and you are at least in line with Google.
on Eclipse, F5 should do the trick. Or right click your project and Refresh. Or Clean all projects. If you are still stuck, simply close Eclipse and run it again.
I imported a sample 4.0.3 project and after deleting it from the Project Explorer list every thing is lost, now there are none of the projects that I was working before in Package Explorer??
Moreover now on importing these old project For Example name "On" are coming with the name "OnActivity" but still not able to run.
Else in workspace every file is ok, I tried to CLEAN but still no effect.
I'm new to devlopment kindly guide me.
Recover the source code from your workspace in the Windows file browser. If all attempts to recover fail, you can just create the projects from existing (recovered) code.
And what project are you trying to run? If APIDemo or QAActivity, the log shows you why you can't run them.
And instead of using the Play button (start) to launch, use the dropdown triangle and select the project to run, else the XML will be run (obviously that won't work).
Furthermore, make sure Eclipse knows it's a Android Project you're trying to run.
It is stuck in cleaning output folder for “Project”. It is not always the same Project. So is there some workaround ?
I tried the method of cleaning the project, but the library update happens too fast. I even assigned a custom keyboard shortcut to Clean and I still couldn't get it in there before it started.
I really didn't want to delete the .metadata folder because it is a pain in the arse to lose your workspace settings/preferences/setup.
So I tried:
Make a copy of the .metadata folder
Delete the original
Launch eclipse (it will open with a default/reset workspace), but it will open fine.
Quit eclipse
Delete the new .metadata folder
Make another copy of your original copy and rename it .metadata (basically put the original back)
Eclipse should now launch fine. In my case the Android Library Update still ran but it actually finished within a few seconds instead of hanging.
Then for me the underlying issue was one of my library projects got into a really broken state. I went into the properties for it, unchecked isLibrary in the Android tab and then refreshed the project. Afterwards I turned the library flag back on and did a clean.
I also had a build error in the library code that had to be fixed.
Any how, hopefully that helps if you find yourself in a similar position. Good luck!
So while I asked this question I found workaround for me , and possibly for others. You have to kill eclipse and on next start , do clean up on all projects before eclipse start that “Android Library Update” task and it will not stuck eclipse.
Deleting the .metadata folder works to get Eclipse back up and running, but after importing Android projects into the workspace the problem came right back for me.
In my case the underlying cause turned out to be the "Android Library Task" being stuck on trying to access the network. I'm connecting to the network via a proxy, and despite being configured in the global OS network settings and all other applications working fine, Eclipse was still unable to access the network. The only thing that worked was, after deleting the .metadata folder to get Eclipse running, manually entering the proxy configuration in "Preferences->General->Network Connections" to match that of the OS network settings.
Now the "Android Library Update" takes a second on startup instead of getting stuck.
In my case the other mentioned methods did not work for me
but "Reinstalling Eclipse and its all plugins" related to my project did.
After doing that it came to the normal state.
My env;
Eclipse Juno (under OS X Mountain Lion)
GWT
ADT
SVN
Another trick that works is to kill Eclipse, delete the ".metadata" folder from your workspace and restart Eclipse.
It'll force your workspace back to its initial state and clear up any hung conditions.
Since installing Eclipse 4.2 I have had to resolve this problem twice. The second time I knew that the only thing that worked for me was to create a new workspace and import the projects from the "broken" workspace. It is very fast and is a good opportunity to de-clutter by leaving obsolete projects behind.
Specifically,
choose File/Switch Workspace/other and put in the name of your new workspace.
Then right click in the Package explorer of the new workspace and choose Import and select Existing Android Code into Workspace.
Then browse to the root of a project that you wish to import and also select Copy projects into workspace.
Hit Finish.
You will have to do the same for any projects that this project is dependent on such as google-play-services.
Recently experienced this, caused by an Annotation Processor throwing an uncaught exception. Killed Eclipse, removed references to the offending Annotation from one project .java file, and started successfully.
In my case, within Eclipse, I had set up a C/C++ Builder to invoke build_native.sh, which is needed to build cocos2d-x. Interestingly, the Android Library Update indicated that it was invoking build_native.sh ! For me this explains why it was taking so long sometimes and seemed to be taking a LONG time to finish. I basically replaced this with an echo command. echo "do nothing" and I think this resolved the hanging issue.
This seems pretty goofy to me -- AFAIK, there's no way to configure 'Android Library Update', and I'm not sure why it's doing what it's doing, since Eclipse has a number of build options which the user can manually control.
I've quite new to Android development and specially Eclipse.
I'm busy on a project called, say 'HelloEclipse'. I've had some major changes ahead, in which I had to some very big changes.
So I made a zip file of c:\workspace\HelloEclipse, placed that in a save place. Went on to work on my project. Few hours later, I wanted to go back to the saved situation. Closed Ecplise, rebooted my computer, because I wanted to make sure there were no locked files. Deleted the old c:\workspace\HelloEclipse folder, place the version out of the ZIP file back.
This resulted in a totally corrupted workspace status. Could not go foward, nor backward. I've ended up, creating a new project, and pasted in everything, took me hours. I think this is quite stupid Eclipse behavior. I've also tried ot, export/import with a archive from out of Eclipse, also not succesfull.
So the two questions;
How am I suppose to save projects (without installing anything like subversion)?
Why is saving the files not enough, and why does that make Eclipse barf?
Thanks in advance!
Dennis
In eclipse if you want to reimport an old project from a ZIP, don't just copy the project files to the workspace, instead, extract the files to a normal dir outside the workspace.
Open Eclipse normally and select File>New Project>Android Project, just as you would to to create a new Android project, but then in the new android project window, you have a radio button giving you the choice to Create project from existing source, point it to the directory where you have extracted your old project and it should be re-imported to the WorkSpace alright.
Or do File>Import>Import existing project into workspace.
But in any case, don't put the files in the workspace manually to avoid conflicts, Eclipse will copy the files it needs itself upon importing.
There are hidden workspace files that you may have missed -- specifically, .classpath and .project. That said, it's a lot easier to make a backup copy (for example, of a released version so you can continue developing while supporting the release) by simply right-clicking on the top-level of the project in Eclipse and selecting Copy, then right-clicking and selecting Paste. The result will be a copy of the project after an opportunity to name the copy.
If you want to zip projects, you can do that by exporting them. If you want to delete existing projects, you should do that from inside Eclipse with a right-click. You can import the zip you previously exported.
If by save, you meant backing up the best something would be to create a local repository. If I were you, I would backup my code in an online repository too; to save it from hardware crashes or other disasters.
In your problem, you could have tried deleting the project alone and import the backup copy(from the zipped file) instead of deleting the entire workspace. Can't pinpoint the exact reason of why eclipse barfed but maybe because it messed up the workspace settings for eclipse. On a related note, I found this on the net.
Eclipse is rather troublesome at times but AFAIK it's the best IDE for android.
First of all, after several months of developing with eclipse I moved to IntelliJ (they have a community edition) and I found it much much better.
In intelliJ you can save local history, for example, you can set-up a label and go back to that label whenever you like without losing anything.
As for eclipse, you probably didn't zip some hidden files or something.
In addition, I remember having some similar problem, I had to resync the files with the project, try this one
Good Luck
I do the same thing with my projects. Instead of going through windows explorer to copy the files, I find copying the entire project from within Eclipse (right click the project in the explorer window pane, click copy, then click outside of the project and click paste) works just fine. When you paste it, you can specify a new save location and project name, which can be your backup space. Then you can switch between versions of the project no problem.