Eclipse does not allow me to open projects in my workspace - android

My Eclipse is an X86 version that came with an ADT Bundle download,I have pointed it to my workspace when it prompted me for the choice of workspace when it starts.When I try to open a project,it throws the following error:
Failed to read the project description file (.project) for 'tess-two'. The file has
been changed on disk, and it now contains invalid information. The project will not
function properly until the description file is restored to a valid state.
My previous Eclipse installation had deleted the Manifest file of atleast one app as far as I know.
The contents of all of my projects seem to have been magically deleted by Eclipse when it crashed after the system restarted.All my files are gone.i have tried opening the files with Notepad++ and they are all empty.Why would Eclipse do that,I do not even have any backups.

Check whether that project is available in your hard disk. If yes, import that to any other workspace. It MAY fix it.

Remove the workspace location in eclipse and create one more work space and import your projects..

Related

Android files gone and cant open files in Eclipse Juno

So, I have searched the solutions for my current problem but it seems it can’t solve with my situation. I use eclipse Juno that I downloaded from developer.android.com.
First, I imported my existing files from C:\Users\Name\workspace. I also ticked to copy project into workspace. But then following error appears: (see this http://i.stack.imgur.com/inmRg.jpg)
Project has no target set. Edit the project properties to set one.
Project has no target set. Edit the project properties to set one.
Parser exception for /Astra/AndroidManifest.xml: Premature end of file.
Parser exception for /Astra/AndroidManifest.xml: Premature end of file.
And, everytime I copied my existing file to android workspace, all of the data imported in my C:\User\Name\workspace[Imported Project] is gone.. All the files became empty (see: i.stack.imgur.com/jFYhm.jpg)
After that, I also realized all files that I want to open can not be viewed in Eclipse Juno. (from file>open file>browse>open) It only shows [X] button but without the file name or the content inside. (see proof: http://i.stack.imgur.com/H6l6r.png).
add:
I also tried another method based on this reply:
stackoverflow.com/questions/2231474/how-to-import-existing-android-project-into-eclipse?rq=1
and followed these steps:
File → Import → General → Existing Projects into Workspace → Next
Select root directory: /path/to/project
Projects → Select All
Uncheck Copy projects into workspace and Add project to working sets
Finish
But in the end, it only shows this pop up:
An error has occurred. See error log for more details.
java.lang.NullPointerException
Please tell me what I should do. I can create new files and copy my data from notepad or else. But I prefer not to do that, because there is high chance that I need to import the project or refresh the project from my workspace. I want to know how to solve this issue.
Thank you for helping!
Create new Android project.
In Project Explorer in drop-down menu disable filter for .* files (Filters --> .* resource)
Now compare content of 3 files .project, .classpath, AndroidManifest.xml between new project and your project.

The data is lost from the project after i import it in to eclipse

I accidentally deleted a completed project of mine from eclipse. The deleted project is still in my workspace folder. I tried to import it in to eclipse by clicking, File -> Android -> Existing android code in to workspace. I had checked my data in the project folder, before importing it in to eclipse by opening it in notepad. The data was all there then. But after i opened it in eclipse, the data is all lost. The java files and xml files are there, but with no codes inside. It is all 0kb. Is there any solution to recover it back ?
easiest way..
start a new workspace and do an android project import of the project form your first workspace.
In future yo should get use to the git dev flow which would be to set up the project in another folder rather than the eclipse workspace..other benefit is that whenever you update Eclipse versions workspace etc you still have a non corrupted subfolder with all your pojrects in it.

Erased project from Project Explorer and cannot re-import it

I erased a project from the Project Explorer, because I didn't think I had everything in the Workspace folder that it needed. I was getting error messages. When I got the complete project into the workspace folder and tried to re-import it I get this message: "Some projects cannot be imported because they already exist in the workspace."
The three folders of the project show up in the window, but are greyed out and cannot be selected.
Thanks to Arun and Francis below.... but new problem
OK. Great! Got passed that one deleting from hard disk and creating a new workspace folder. But now when I try to run it as an Android Application I get the message, "No compatible targets were found. Do you wish to add new Android Virtual device? And in the Console: "Failed to find an AVD compatible with target 'Google APIs'." I'm really new to this so thanks for whatever patience you have to answer newbie questions.
Try back up your project folder and delete the project completely from project explorer and from the hard disk. Make your backed up project folder into a zip file and try re-import it and recreate a separate project copy in your workspace. If this doesn't work, try switching workspace...... :)
So it sounds like the project is still there in the workspace, so try deleting it again. When you delete it, make sure you select the option "Delete files on the disk", this will actually remove the underlying file in addition to just removing the project definition from the workspace.
If you still have trouble (that is, the project is still there), delete the files from the workspace associated with the project by hand (in the operating system). And then Refresh the project and try deleting it from the workspace again (don't select the option to delete files on disk). It should be gone then.
Once the project is gone from the workspace and the underlying files are gone, try your import again.
If you use working sets, make sure they are all deselected. Only the projects from the current working set will display in Project Explorer. By having no working sets selected you can see all the conflicting projects in Project Explorer and delete them by hand. Then re-import.

Eclipse Android won't clean, won't refresh resources

I upgraded to Ubuntu 11.10, Eclipse 3.7.0, ADT 14.0.0.
When I replaced a picture resource in the /res/drawable-nodpi directory on the desktop, or a sound resource in the /res/raw directory, both the recompiled program and the Project Explorer use some previously cached version.
I tried the following, none of which worked:
right-click on filename in project explorer: Refresh
right-click on /drawable-nodpi dir in p.e.: Refresh
right-click on /res dir in p.e.: Refresh
right-click on Project in p.e.: Refresh
Project -> Clean...
Project -> check Build Automatically, Run->Run
The program recompiles new source code changes correctly, but reuses its own cached resources.
This is with an existing project that used to work under Ubuntu 10.
As a workaround, I renamed the file on disk; Deleted the file in the Eclipse Project Explorer; restored the name of the file on disk; and then dragged the file from the desktop into the /res/drawable-nodpi folder in the Project Explorer. Eclipse came back with a popup asking whether I wanted to Copy or Link the file into Eclipse. I chose Link. This finally got the new version of the resources imported.
Update: After the source code that used these images got modified elsewhere, it quit recompiling, saying R.drawable.mypicname no longer referred to anything. So the Linked resources don't appear to be reliable after all. The latest workaround is to manually Copy the file on the desktop and Paste it into the Eclipse ProjEx /res/drawable-nodpi directory. This recompiled without any source code change, and ran on the device.
Both Clean and Refresh not working correctly is quite unexpected behavior. Why is it doing this? What am I doing wrong? How can I set the Eclipse environment so that when I change the file on disk, it uses the current latest version? Or at least allows me to Refresh? Thanks.
Enable lightweight "refresh on access" to keep the workspace synchronized with the filesystem.
This option in Eclipse is in Preferences under General->Workspace as shown here.
Look for bin on your application. Probably there is a folder called res/crunch, so search for your drawable that isn't refreshing and refresh manually.
In my case, I import the wrong 'R' so that eclipse couldn't find the right image file.
try change this: import android.R; => import com.example.myfirstapp.R;

Missing AndroidManifest.xml when importing an old Android project into Eclipse

I have an Android project developed on Eclipse (GNU/Linux) that I last touched half a year ago. I am trying to import the project into Eclipse 3.6 on Windows (with ADT installed) installed using File -> Import Project in Eclipse. When the project is imported, I see the following error twice on the console:
[2010-12-10 02:17:12 -
com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper]
Unable to read C:\Program
Files\Android\android-sdk-windows\AndroidManifest.xml:
java.io.FileNotFoundException:
C:\Program
Files\Android\android-sdk-windows\AndroidManifest.xml
(The system cannot find the file
specified)
Why is Eclipse looking for AndroidManifest.xml on the Android SDK path? The file actually seems to be in the project's directory. How do I fix this problem and get the project to compile?
A simple solution is to either reimport the AndroidManifest.xml file or make a change to the file and save it. This worked for me.
If you see an error about AndroidManifest.xml, or some problems
related to an Android zip file, right click on the project and select
Android Tools > Fix Project Properties. (The project is looking in the
wrong location for the library file, this will fix it for you.)
from: http://developer.android.com/resources/tutorials/notepad/notepad-ex1.html
The way you are importing the Android project into Eclipse is wrong. The Correct way of doing is File -> New Android Project. In the Contents Tab in "New Android Project", select "Create project from existing source" and choose the Build Target. That should fix your problem.
It appears that this error is produced because Eclipse thinks the default location for new Android projects is the Android SDK path. Even if the project location is changed, the error fails to be resolved, so the trick is to change the project location before Eclipse is aware of the condition generating the error.
To circumvent this quirk I imported the old project with the following steps:
File -> New -> Android Project
Un-check 'Use default location' and browse to project root directory.
Click 'Create project from existing source'
It's important to do step (2) before (3) otherwise the error persists and prevents running the project.
I had the same problem, all of the above did not work. I cleaned the project and it worked.
Instead of using File ---> New Android Project --> "Create project from existing sources", which will result in the error your are seeing, choose "Create project from existing sample" and choose it from the drop down. This will work.
Experienced JAVA developers tend to go with the first option which is normally there and works for classic Eclipse projects. But this is not your typical project and I bet the Google developers put this special case in the wizard to accommodate the differences.
I had the same problem. I was trying to compile the JakeWharton view page sample, so I checked out the GIT in a directory in a different folder then the workspace which caused the problem.
Eclipse was maintaining 2 folders:
1. A new workspace folder was made under the workspace directory, which eclipse checks for libraries and others source code including the AndroidManifest.xml file
2. The existing folder which was not under the Root workspace
To fix the problem after importing I had to manually move the files in the new workspace folder created by eclipse.
I met this problem when using Facebook SDK, now I solve it by doing this:
Close the project;
Copy "AndroidManifest.xml" file to the project's root path;
Open the project and refresh it, it's Done!
this worked for me by the way:
I changed the project name to the exact name of the project that I am importing.
Eclipse seems somewhat fragile in its naming conventions. One of the causes for this error is a difference between the project name and the folder name in the workspace. I imported a zip file for a project named "HelloDialogs" into a workspace folder named "HelloDialog". This caused the "AndroidManifest.xml file missing" error. Once I renamed the folder correctly, everything worked fine.
Because of the multiple different answers here, I thouhgt I'd add yet another one that worked for me, as I had exactly the same issue when first working with Phonegap android dev tools.
So I found (as mentioned by Gintautas in comments to the accepted answer), that I had to create a new project using the phonegap 'create' script, then when importing the project into eclipse. the only way to get this to work successfully was if the project was originally created in some temp folder somewhere other than the place I actually want to work with it.
So I created a project in windows like this in a cmd window...
c:\phonegap\phonegap-2.6.0\lib\android\bin>create.bat c:\temp\android_boilerplates\test app.test test
Then I imported the project in eclipse like this...
File > New > Project
Within the new project wizard select: "Android Project from Existing Code"
Click "Next"
Now navigate to the temp location of your project and set that to the root directory, check the project you want and check "Copy projects into workspace" as the example below...
Click "Finish"
And that's it, Eclipse should copy all your project files into your workspace and there shouldn't be any errors in your project (fingers crossed).
Your project should look something like this...
Hope that helps, it took me an age to work out why Eclipse didn't like creating a new project from existing code when the new project was being setup in the same place as the existing code. This isn't a problem for other languages I've used, so it was a little weird, but understandable as Eclipse (I'm guessing) seems to want to overwrite certain files.
Eclipse randomly decided to make another folder instead of the one that i had specified, but doesnt have any resources or data or layout etc in it..
it has some conflicts i guess..
anyway, a noob approach to this was, copying the original file to some other location(i put it to desktop)..
now create new project-create existing project, select this one from desktop, n VOILA.. its all fine.. :D
I am a little late to this game but I caused this same problem by generating the initial application into the exact location I was going to work on it. That is to say I put it directly into my current workspace. I then did File, Import, Existing Android Code Into Workspace. The import process blanked out my android.xml file.
I tried above solutions and had no joy. I then generated the initial application into a temp directory and imported from there. This worked for me.
The only way to import a project into eclipse workspace is to create an empty project and then drag and drop all the folders and files into this project. Why is this so is beyond me.
The answer from Raunak is wrong.
I found a .classpath file in the root directory of my Android project. I opened it and updated the file paths in it, and it seemed to fix the problem for me.
I had the problem when I tried to update an old project with recent code from the SVN. I had the Manifest.xml exported to my local file system as backup and deleted it. I've then reverted my complete project to the most recent version from the SVN and then it worked :)
This is what I had to do to get this to work. Fortunately I had backups of earlier "project".
1) Import the project as usual.
2) If the errors with empty xml etc. comes up, close the project.
3) Go to the original project if you have backup.
4) Copy all of the projects root files and directories and paste it over where Eclipse expects the projects root directories and files to be.
5) Open the project and refresh. Make "Clean" if necessary and you're done!
Always make backups because Eclipse f--kups! I learned this the hard way when suddenly my Android project refused to work because of empty manifest-file.
Sometimes if you automatically fix imports in MainActivity IDE imports android.R class instead of one that will be generated for the project. Remove the import and recompile.
when importing project from another workspace add existing project in workspace. and tick to the copy projects in workspace.then check the api level and supporting library from project.properties files.then rebuilt project and clean it.. it is works for me.
2017 Solution: Much Easier and tested solution is to remove your application folder from elipse project only then Import it again and the problem will be fixed immediately!

Categories

Resources