Eclipse Projects not loading in my Package explorer? - android

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.

Related

Eclipse Android Programming R.java is missing in a New Project

The title says most, but I have created a new project in Eclipse. I have everything set up, and as soon as I create a new Android Application Project, once everything has Generated there are 2 Errors: both "R cannot be resolved to a Variable", on Line 19 and Line 12. In the Video Tutorial Series I am watching it says there should be a file called R.java in the gen folder, but there isn't, just an empty folder. The Android project is completely new. Here are some of the things I have tried after googling, none solved the Issue:
Clean Project
Uncheck/Re-Check Build Automatically
Build Project
Close/Open Project
Check XML files for Errors - only the Two Errors as mentioned above in the Error Log
add "import android.R.*"
Create R file manually (Add -> Class)
It is my first time writing an app in eclipse, I know there are a lot of questions like this but none seem to solve my problem. The Java Errors (R not resolved to a variable) Errors are the only errors, no errors in the XML or Anything.
So that you can check my project, I have put it in my Dropbox if you want to have a look at it in eclipse.
Project Download Link
You can create the new Project and then copy the contents of this project into the new one.
This problem is with Eclipse. I recommend you to use Android Studio.
What might help, would be to create a new project and transfer the current project to that one. When the R file is not created when creating a new project, try and re-download the development tools and sdk.
I'm sure that the problem may be with your ADT tools in eclipse. Sometimes, this errors may occur due to some installation mistakes or some sort of software cracking problems. I also faced the same problem at my starting stage. The best thing that you can do is to move on with re-installation of ADT in you eclipse. It may help you. Try this!! Create you new Android Project and Enjoy buddy !!
I was having this exact problem, and found the solution after much headache.
In eclipse, find and click the button labelled Android SDK Manager (next to save, and all that jazz on the toolbar).
In the manager, make sure that under the "Tools" folder all of the relevant "Android SDK Build-tools" have been installed. Once they are, restart eclipse, and your R.java file should be generated. Hope that helps!

android eclipse projects in package explorer disappears

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.

Error found after importing archive file in eclipse

I am a very beginner in android development using eclipse..
I have given an assignment to modify the android application made by a professor..
so I downloaded the file and imported it to eclipse.
My professor can normally run the program..
however, when I tried to test it before modication using simulator, " the application is forced to stop unexpectedly" is shown..
Moreover, I found that all .java file in src contained "x" ...and the codes in the .java file, like "import android.graphics" or "private class xxx" all contained error..which i have been told that "import andorid.graphics" cannot be resolved..
Could anyone tell me what's wrong with the codes...
and kindly provide me the procedures to fix this problem?
is it possible for me to send the zip file to someone..so that he/she can help me find out the problem??
Make sure the Android sdk and ADT are configured properly in Eclipse and you have updated the relevant packages using SDK Manager. Best way to test this is to create a HelloWorld Android app
http://developer.android.com/sdk/installing.html
Assuming that you have correctly installed the same Android SDK that your professor is using, the first thing to try is to right click on the project name, then select Android > Fix Project Properties.
I've often found that importing existing Android projects into a workspace can be problematic, especially when the project comes from a different machine. A work-around is to create a new Android project, then copy all the sources and resource files into the new project. It's a pain, but it avoids many problems that arise due to different development configurations.

Copying an Android Project Folder is Not a FULL Backup?

Several weeks ago I took a snapshot of my Android project by simply copying the entire folder (Windows 7) to a network share.
A few weeks later, I wanted to build that snapshot in a new (and different) workspace. So I:
Created an empty folder for the
workspace,
Switched Eclipse to it,
Then used File > Import... to copy
that snapshot to the workspace.
I was then surprised to find errors in the project - errors that weren't there before I copied it over to the network share.
The first symptom was that only the last file in the project had multiple errors. I "fixed" that by entering into Eclipse (again!) Android's SDK location:
Windows > Preferences > Android > SDK Location: C:\android-sdk-windows
This resulted in numerous files now having errors, with the following hint at the console:
Android requires .class compatibility set to 5.0. Please fix project properties.
I fixed that by hovering over #override and selecting the Change workspace compliance and JRE to 1.5 balloon suggestion. This is strange because I checked Windows > Preferences > Java > Compiler > Compiler compliance level: and it was 1.6 before - Doesn't 1.6 include 1.5?
I was then left with only two errors stemming from #Overrides that shouldn't really be there (for methods implementing interface). So I removed them and now all is fine and the project builds and runs perfectly as before.
All nice and dandy but I was very surprised by the fact that I actually had to change anything in Eclipse, not to mention that I eventually ended up modifying the original source code (deleting #overrides only) to get it build - source code that had no complaints whatsoever weeks ago!
What could possibly explain this? Isn't copying an Android project folder a true full backup?
Being baffled by this discovery, I examined the workspace folder, using my beloved Emacs, and discovered that there is a hidden subdirectory named .metadata. This is probably where the secret lies.
My questions now are:
Does Eclipse store additional
information about the workspace
elsewhere?
What is a good approach to make
Android projects more independent,
as in "fully backup-able"?
Is there any use for the
.metadata/.log file? Can I safely
delete it?
I had those errors too when imported a project. If I'm remembering correctly, helped right-clicking in project name and selecting Android Tools -> Fix project properties...
After that errors disappeared.
“Android requires .class compatibility
set to 5.0. Please fix project
properties.” What’s this? It’s the
error I received after cloning a
repository and trying to import it
into Eclipse. There is reasonably
little information online about this,
couple discussions on mailing lists
but I figured I would write a post on
the solution to this.
After importing the project to your
workspace, you’ve received the error.
So what you need to do next is to
right click on the project -> Android
Tools -> Fix Project Properties. Now
this alone won’t fix the problem, you
need to restart Eclipse after this.
After that try building the project
again and it should work successfully
this time (unless you have bugs in the
code itself, I did).
I've found that Eclipse's metadata is stored, as you found, in the ./metadata folder of your workspace. I do not believe there are any additional folders but I will double check.
The best way to do a back up of the android project if you are using eclipse is to export it by right clicking the project, selecting export and exporting it as an archive, file system, etc. That way you can be sure you've backed it up in a way that Eclipse knows how to handle it.
Rather than delete it, why not make a copy of it first? Edit: I would also take a look at running eclipse.exe -clean in the command terminal. That may be more useful than manually deleting the .metadata folder.

Move Android Eclipse project into workspace

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.

Categories

Resources