Copying an Android Project Folder is Not a FULL Backup? - android

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.

Related

No project showing up in project explorer in Eclispe for project created on separate computer and shared through SVN

I have a project in an SVN folder like so
SVN/Android/Project/WorkingDir/Project
When committing, I think I added all of the metadata folder to the ignore list. I then set up SVN etc. on another computer and opened up the same workspace "WorkingDir", but nothing showed up in the Project Explorer.
I checked the filter settings etc., I tried importing the preferences from the first workspace, I tried going into Import Exisitng projects (but it didn't recognize anything in the folder, even though the project is right there).
I've looked through StackOverflow and came across similar questions like the ones below, but none seem to help me
Android+Eclipse project sharing via SVN?
Do I need to use "Subversive"
e.g. SVN not working in Eclipse
Perhaps .classpath, .project need to be added to the repository? Looks like they currently aren't.
Via: Why "no projects found to import"?
OK, syncing the .classpath and .project and project.properties files seemed to help.
Also I had the explorer filters messed up, so even then nothing was showing up, but I think the .classpath and .project were still necessary to get things to show up. Not sure about properties though.
Then I had this problem Android requires compiler compliance level 5.0 or 6.0. Found '1.7' instead. Please use Android Tools > Fix Project Properties and solution there helped.

Can't checkout an android project in STS 2.9.1 and Subversive on Windows 7

The problem
I have a strange problem with SpringSource Tool Suite 2.9.1 Release and Subversive plugin, running on Windows 7 Home Premium x64. I'm trying to checkout an android project from an SVN repository.
Here's what I'm doing:
File > Import > SVN > Project From SVN
I fill in the path to my repository and check the HEAD revision
I click Finish
The project is found and the default option is Check out as a project with the name specified. I leave the name alone Set the Depth field to Recursively and again, select the HEAD revision.
I click Finish
A progress bar appears for a second just to show an error message:
Checkout operation for 'https://(.....)/Android' failed.
svn: Cannot create new file 'C:\workspace-sts-2.9.1.RELEASE\AppName \.svn\lock': System can not find the path specified
When I retry and follow the steps from 1 to 6, another dialog appears. It says:
This project already exists in the workspace
or there is a data folder in the checkout destination.
It allows me to select a folder to overwrite. When I do that, a similar but different error message is shown. It says:
Checkout operation for 'https://(...)/Android' failed.
0x0000000f: The folder 'C:\workspace-sts-2.9.1.RELEASE\AppName \.svn' is locked by some external process. Please unlock the folder and try to check out the project again.
What I've tried
First, I opened the SVN Lock view to see if there were any locks created by the IDE. There were none.
I restarted the computer, hoping it would solve the problem of any application locking the file but this does not seem to be the case.
After that, I created a new workspace in a different location and tried to check out the project in there. The result was the same.
Then, I attempted to change the version of SVN Kit. The situation persists in:
SVN Kit 1.2.3
SVN Kit 1.3.5
Native Java HL 1.5.4
Native Java HL 1.6.12
I thought that changing permissions to the directories of my workspace was worth giving a try. It didn't do the trick either.
Finally, I checked out the project in a different location, using Tortoise SVN and imported it into my workspace. I could run it (though some build path settings seemed to be missing) but it's not a solution. I can't possibly imagine working on the project simultaneously with a couple of people without the ability to commit/update/view history/resolve conflicts in my IDE.
I was advised to install a separate version of eclipse with its own set of tools and a different workspace for this application alone but it doesn't seem like a good idea. I'd like to keep it all in a single IDE. I'd also prefer to avoid reinstalling the whole thing as I don't feel like configuring all the other tools (mostly spring and android-related) from scratch.
Has anybody seen a situation like this? How can I get it working?
It's uncear to me whether this is a subversive problem or an SVN problem. I would try checking out from the command line (you must install SVN command line tools to do this, but I'd recommend having the tools around as a backup anyway).
Checkout from the command line and then import into STS using File -> Import -> Existing projects into workspace. Once in the workspace, you can select the project -> Team -> Share project to get svn support on it.
Rename the project and check out again , It must be a problem where u are trying to checkout the project which already exists with same name in the Package Explorer

Error with parsing Android sdk content and initializing java tooling in eclipse

Every time I open Eclipse, I get the following error messages:
Android SDK Content Loader:
parseSdkContent failed java.lang.NullPointerException
Initializing Java Tooling
An internal error occured during: "Initializing Java Tooling". java.lang.NullPointerException
Loading data for Android 2.2
Parsing Data for android-8 failed java.lang.NullPointerException
Loading data for Android 2.3.3
Parsing Data for android-10 failed java.lang.NullPointerException
Loading data for Google APIs (Google Inc.)
Parsing Data for Google Inc.: Google APIs:8 failed java.lang.NullPointerException
See link for screenshot:
http://i.stack.imgur.com/lhhQQ.png
(I am using OS X Lion, and Eclipse Helios)
First i read some posts saying that it was the AVD.ini file in the .android profile that was causing the trouble. I tried deleting all the entire .android profile folder as suggested in Android SDK Content Loader failing with NullPointerException. This didn't correct my problem.
I tried deleting the entire Android SDK folder, downloaded it again and installed a couple of Android versions through it. Still the same error messages...
To ensure that I didn't have any old plugins or something that were the issue, I uninstalled eclipse, downloaded it again and installed the Android plugin again. (So the plugin is up to date).
When I go into one of my Android projects, I get error messages on places where I acces resources by using the R file. Regular Java projects work fine, but all Android projects gets small red boxes with white crosses on them. I have been searching for a solution to this problem since yesterday, but at this point I'm completely qlueless and would appreciate any help I can get!
Close all open projects and exit Eclipse. Now you can open Eclipse without getting the error. Start opening your projects one by one to find which one causes the problem. This is most likely because you deleted a Device profile inside the AVD manager.
Do not delete all the full .metadata
Backup .metadata
delete only .metadata/.plugins/org.eclipse.core.resources/.project
restart eclipse
Observation : the projects folders are created
Further - if you are using svn/git/hg have code repository links it would be destroyed, so to reinstate
close eclipse
copy relevant projects from backup to merge with current projects in .metadata/.plugins/org.eclipse.core.resources/.project
restart eclipse
Downfall - sporadic fail error may occur (sync or something) - harmless
backagain
I encountered exactly the same issue this morning. This is a workspace related issue.
Solution 1
I looked into my .metadata and read .bak_number.log files . Some layouts failed to parse and my projects were out of sync with the file system.
So I deleted all the .bak_number.log files. Relaunch Eclipse and the whole worskspace should work again the way you left previously.
Solution 2
However if it's not due to out of sync with the file system. Change the workspace then import all the eclipse projects from the previous workspace.
Thanks the project.properties files , the dependencies are still kept.
PS : I should return to IntelliJ :)
first close your Eclipse
Go to your workspace and rename .metadata to tushmetadata and go to
tushmetadata- >.plugins -> org.eclipse.core.runtime -> .settings
and copy all files from it.
now open the Eclipse and go to your workspace there you can see the
newly generated .metadata folder in that go to .plugins ->
org.eclipse.core.runtime -> .settings and paste here and do not
overwrite any file.
Try to "Hello World" project and run it.
Try to delete file .metadata from your android workspace folder. .Metadata folder contains all configuration files for eclipse. It works for me.
Your answers might be right. What I did was to change my workspace. I redownloaded the project I was going to work on from git, and reimported it. Now it works fine :) Maybe there was some files in this project that made the error messages apear? Dunno....
I have remove the .metadata folder but after it, when I run the eclipse, I cannot creates any Android project. To solve it, I have done the follow:
Go to the main work directory of eclipse
Localize the folder com.android.ide.eclipse.adt It should be in .oldMetadata/.plugins/
Copy it to the new eclipse configuration: .metadata/plugins/
See the full solution here:
http://www.jiahaoliuliu.com/2011/06/running-android-sdk-in-eclipse-errors.html#solution4
For me, the source of the NullPointerException problem was a host-side Junit test project that references (and tests) code from an Android project. It didn't have a project.properties file. It's not an Android project, but for some reason the newer versions of the SDK somehow expects the file there. To fix the problem, I just copied a project.properties file from an Android project to the host unit test project.
When I met this problem about a year ago, I had some projects in my workspace that needed a specific Android SDK level (let's say 2.1) and i didn't have it installed in the Android SDK.
slott's answer helped a lot. Deleting the .metadata or reinstalling eclipse didn't though. The trick was to isolate the project causing the problem, delete its .settings folder and .project file and reimport it.
I discovered another cause, where I'd added a space character into an otherwise blank line in the project.properties file. When I eventually ran android update project -p .
the program (android.exe) threw a NPE exception. When I deleted the space from the blank line the android update project command worked and eclipse started behaving (after running clean a few times).
This happened with r20 of the Android SDK on a Windows 7 64-bit machine.
FYI my change that fixed the problem in project.properties is public at http://code.google.com/p/android-daisy-epub-reader/source/detail?r=517
This is just weired.
In my case when I took a subversion update, I was getting this problem. The reason was the corruption of my project.properties file (due to subversion conflict).
I just corrected the file and problem got solved.
I found it's just missing project.properties file in the project folder. After copying one from another project the error is gone. The only valid line in project.properties is
target=android-8
If you are using SVN or GIT please check whether the project.properties has conflicts or not.
Sometimes project can not be open because of this.
I hope this is useful to someone and saves his/her time: My colleague was facing same issue and we did almost everything mentioned here, with no luck. In the end we changed the Android SDK version in the manifest file and it worked.
This solution worked for me.
Close Eclipse and delete all .markers inside your workspace folder.
Restart Eclipse (once I had to restart it twice, it hang on the first but worked on the second for no aparent reason).
Of course, it's always safe to back them up first.

Why is my updated Eclipse / Android setup not building my APK anymore?

I had a working Eclipse setup with 3.6.2 and SDK tools from version 11, and it has been building my main project just fine for quite a while.
For a different project, I thought I needed to upgrade my SDK to the latest and greatest - at this point API 14 (ICS 4.0).
I cannot even reconstruct the steps I went through, but what happened was that my project would seem to build, but I would see that it would say that it was skipping a post-compiler step, and at the end I would have no APK.
I also noticed that it updated my .classpath so that the output path was bin/classes instead of .bin.
Along the way I tried updating my Eclipse to the latest version (Indigo 3.7.1) but this didn't help.
I solved the problem eventually with help from this post on the Google Android forum:
http://code.google.com/p/android/issues/detail?id=21031
For me personally the biggest issue seemed to be solved as follows (qutoe from comment 25 in the forum post)
"I seem to solve the problem with .apk files not being built automatically until run/debug is used (comments #10, #11 etc.). Go to Windows -> Preferences -> Android -> Build and uncheck "Skip packaging and dexing until export or launch" then restart Eclipse. Works for me."
But there is other useful material there. Different people with different projects seem to have different problems with this setup.
I still don't understand the change in the classpath, but it doesn't seem to matter.
In addition, I found a discussion of installing the ADT with Eclipse Indigo which was helpful here in Stackoverflow:
Eclipse Indigo - Cannot install Android ADT Plugin
I also found that I guess because of various uninstalls/reinstalls, for some reason it stopped excluding my .svn directories from the sources. This Stackoverflow post was helpful with that:
Why is eclipse trying to copy my .svn folders from src to bin, and how can I make it stop?
Finally: a tip for really and truly uninstalling Eclipse - everybody says there is no uninstall, and there isn't, but there is a directory that Eclipse leaves in your home directory (in windows 7 under c:\users\) called .eclipse -
Zap it if you really want to start fresh.
In addition, for less extreme measures, there is Project->Clean inside Eclipse, and you can invoke eclipse with "eclipse -clean" for additional cleansing effects. No idea what, but various helpful people along the way suggested trying that to solve problems.
Ah yes - when I first installed Indigo and tried to build, I got a warning that my Java Compiler Compliance level was not up to snuff, which was simply not true - I have only Java 1.6 installed on my machine.
See this post for somebody who had similar experience:
http://marakana.com/forums/android/general/374.html
For me, what worked was simply going to Project, Properties, Java Compiler, then click on Configure Workspace Settings, and click on Ok in the dialog. Didn't need to actually change anything. Just showed it that everything was ok!
Eventually I indeed did clean out my Eclipse and Android installations (including the aforementioned .eclipse directory, and there's also an .android directory in your home directory which you may want to erase if uninstalling the Android SDK Tools doesn't do that - this actually is uninstallable). Installed everything from scratch and then used the additional information provided above and now it's building my APK.
I hope this saves somebody the hours I spent getting my build back in shape.

Eclipse Projects not loading in my Package explorer?

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.

Categories

Resources