Eclipse is really bugging me with this. I have an Android project that is not in the workspace. Since Android projects don't work correctly if you use Eclipse's Import>existing project you have to make a new Android project from a folder on disk. If this folder
is in your workspace, it won't work. If it isn't it works, but then the project is located outside of my workspace folder, which is irritating. Does anyone know a way around this?
You can fix this by following this alternative import flow:
Make sure your project folder you want to import is in your workspace folder
In Eclipse, go to File → Import...
Click General → Existing Projects into Workspace
Make sure the "Select root directory" radio button is selected, and browse to your workspace directory.
In the Projects box, check the box next to the project folder you want to import and click Finish.
This will properly import your Android project.
I've experienced this problem too, when, for example, I tried to create a new android project based on existing source (the Notepad Exercise 1 example program that the android developer's documentation provides). I believe the problem you are experiencing with Import not working is that what you are trying to import a "project" that isn't really an Eclipse project at all (e.g. no .project/.classpath - it's just source code with a directory structure that deceptively looks like a project).
Like cisteams has alluded to above, if this is the problem, the procedure around this goes something like this:
Make a new android project choosing "Create project from existing source", making sure that the source directory is indeed outside your workspace (you'll have to live with this for a second). This should a) make the necessary .project/.classpath files in the source directory (which is still outside your workspace for now) and b) make the project show up in your list in Eclipse.
Right click the project in the Package Explorer and choose Delete, making sure that the option to delete files on disk is unchecked when it comes up.
Now import the project like you would any other project (you can do this now because the .project/.classpath files were created in step 1 above). There should be an option when importing for "Copy projects into workspace", so tick that option.
And you should be done. You can go back now and delete the copy of the project that isn't in your workspace to avoid confusion later on.
What version of Eclipse and ADT are you using?
Currently this approach is working fine for importing projects that are checked out from SVN. It does require that you have a .project and .classpath files (normally they are checked in to revision control).
If you do not have these files (some open source examples don't include them) then you need to use the Android Wizard for creating a new Android project from existing source. The key here is that it is a New not an Import, so yes it doesn't like it if the files are in the workspace. What you can do is create the new project externally using the wizard to create the .project and .classpath files. Once those exist you can use the normal import to bring the files into your workspace (and check those missing files into your source control).
Also you must delete the current install on your phone or you will get a signature fail from other comps install of the same app. So do the above and uninstall app off your phone before running the app on the new computer.
Related
Hi I am having problems with the Eclipse for android development.
After the computer is hanged I restarted again and open Eclipse the package Explorer shows nothing.
I tried to reboot computer / reboot Eclipse, but still fails
I then tried import back those app (say abc project) that beforehand developed but it says it duplicates the abc project that already exists. It appears that the package folder has actually something inside but the projects just appear invisible. How could that be repaired?
I have researched through the web but find no way out. It makes me headache...are there any method for repairing?
Thanks in advance for all your help!
You already have the project inside the workspace but eclipse is not recognizing it. In this case, You'll have to re-import the project.
Copy the code from the workspace through your windows explorer (or finder in mac) and paste it outside your workspace.
Then import it again using the code you just pasted outside. Check "Copy projects into workspace" option while importing.
Delete the code you copied outside the workspace.
The project will be re-imported and there will only be one copy inside your workspace.
Also see:
How to import existing Android project into Eclipse?
Try create another workspace and copy the projects there, then delete the older workspace and rename the created workspace. Should work.
This is what I did. If there is a better way please reply.
Make sure all developers have installed Android SDK & Tools in the same paths.
Install the Eclipse TFS plugin from Microsoft.
Link at the time of this writing is: http://www.microsoft.com/en-us/download/details.aspx?id=25125
Here are the steps I followed:
I started my Android project in a random folder (workspace) and did my initial development.
Then I wanted to move the project under my development branch at $root/Development/MyBranch/Android
The Android folder did not exist, so I created is using TFS. If you do it manually from explorer then TFS will not let you create it server-side.
From the original project workspace I did "Export" --> "General|Preferences", to some folder.
Then I did "Switch Workspace" --> "Other"
I specified the local path of $root/Development/MyBranch/Android
Now I get an empty workspace.
Then I did "Import" --> "Project Settings" and specified the file I exported before.
Then I did "Import" --> "General|Existing Projects into Workspace" with "Copy Projects into Workspace".
Amazingly enough I got my project up and running from the new location, with a few hiccups as usual.
Then I did "Team|Share Project..."
I followed the wizard.
There is a crazy screen about creating a new workspace. Just click EDIT and make sure that the TFS root mapping is ok.
Finish the wizard and you are done so far.
When you run the project, the plugin will also add the gen and bin folders to TFS.
Don't try to battle this, just check them in. More details later.
At this point, I have everything checked-in, so I merge to Main.
At this step I want to merge the project to another developer's branch.
The process is similar.
Using TFS create the $root/Development/OtherDev/Android folder.
Start Eclipse on the dev's PC and do "Switch Workspace" --> "Other"
Specify the local path of $root/Development/OtherDev/Android
Now you get an empty workspace.
Then "Import" --> "Project Settings" and specify the preferences file exported before (I included it in TFS for reference).
Then "Import" --> "General|Existing Projects into Workspace" with "Copy Projects into Workspace" and copy the project from the local folder of $root/Main/Android
Then do a "Team|Share Project..." to connect the project with TFS.
Now close Eclipse.
Do a merge $root/Main/Android to $root/Development/OtherDev/And
Checkin $root/Development/OtherDev/Android
Guess what, looks like you are done. Unless I did something wrong, but it "works on our PCs", so far.
Special note: Since Eclipse/TFSPlugin will always try to add the gen+bin dirs to source control, simply keep them always checked out, and even if you check them in sometime, don't merge them back to main. It's just a waste of disk space on TFS merging these files around.
This method is so complicated, that it just doesn't feel right.
Is there a better way to get the same results?
Thanks!
As for the bin/gen directories... TFS 2010 SP1 and newer has an ignore option. Bin should be added automatically but gen isn't. To add, Right click the folder, then choose Team and then Click Ignore. You will probably need to remove these folders in TFS aftwerwards, but they will not sync with TFS anymmore.
I kind of feel stupid, but I just can't get it to work....
I have an existing Android project copied from my other pc, in the folder
c:\projects\trunk\android\emergency
(I created that project on the other pc, copied it to my new pc and the other pc is given away)
Now I want to open the project in Eclipse. So I THINK I tried everything, but I can't seem to get it to work...
I looked for something like 'open project', but didn't find it.
Then I tried 'import', but that wouldn't let me import it because it was the same workspace (I use the same filelocations and workspace location as on the other pc)
Then i tried creating a new workspace and import it there. Then it complained about have no project, that i first had to create one. So i did create a dummy one in the new workspace, imported the project, and it copied everything to the new workspace, and placed it below the dummy project.
I am SO stuck, can you help me?
Btw, this is the Eclipse i'm using:
Eclipse SDK
Version: 4.2.0
Build id: I20120608-1400
Try File > New > Project... > Android Project From Existing Code.
Don't copy your project from pc into workspace, copy it elsewhere and let the eclipse copy it into workspace by menu commands above and checking copy in existing workspace.
It's the "Import existing project into workspace" option under Import->General.
See:
http://help.eclipse.org/helios/index.jsp?topic=%2Forg.eclipse.platform.doc.user%2Ftasks%2Ftasks-importproject.htm
Window->Show View->Navigator, should pop up the navigator panel on the left hand side, showing the projects list.
It's probably already open in the workspace, but you may have closed the navigator panel, so it looks like you don't have the project open.
Eclipse using ADT Build v22.0.0-675183 on Linux.
File > Import > General > Existing Projects into workspace.
Select the root folder that has your project(s). It lists all the projects available in the selected folder. Select the ones you would like to import and click Finish. This should work just fine.
i use Mac and i deleted ADT bundle source. faced the same error so i went to project > clean and adb ran normally.
Right click in navigator-Import-existing project..-select the base directory of your project
Assume that the application folder is in your pen drive.
open eclipse, go to import,select Android,In Android select "existing android code into workspace"
next and finish.
Ramanand Bhat
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.
i was developing Android applications on my macbook pro after which i had to shift to the iMac at work. So i copied my Eclipse directory and the android sdk and the workspace and pasted it on the iMac at work.
I have set the Android sdk root inside the preferences of the Eclipse but the workspace is not loading inside my package explorer?
i have made the workspace folder inside the documents folder where it was in my macbook pro.
When Eclipse starts i choose the specified path of my workspace and then start eclipse.
Why are my workspace projects not being available in my package explorer?
thank you in advance.
EDIT:
i imported the project into my workspace. But there was .classpath 5.0 compatibility error, so i right clicked on my project and clicked android tools -> fix project properties. That error regarding .class path compatibility went away but a new error came in which the whole src folder inside my project has errors.. i mean each and every class.
And the error is regarding classes that come in the Android library...for eg. it is giving me error in the getCount method saying there is no such method in a class i used to extend the BaseAdapter class..what is going wrong here?
i have cleaned my project several times, but no change.
I just experienced something similar - had to create a new workspace and import the projects from my previous workspace to make it work. Pretty annoying, but it seems to be a bug in Eclipse.
Make sure that the build path of the project links correctly to the Android SDK. Right click on the project and choose configure build path and make sure that there are no red marks there.
Your project list is stored at .metadata.plugins\org.eclipse.core.resources\projects\, so you might want check that file to see if your projects are there.
from : Eclipse - No project visible in explorer
What helped me is i went to the package explorer and on the right site click the menu i.e. go to Filters -> Non Shared Projects. Remove that check mark. Then i see all projects.