Work on an Android program with several computers - android

I am developing a project from work, but would like to be able to take the project home and continue it. I can't just "open" a project, so what are the settings to save it on one computer, then open it from home, then save it again to work on it from home?

I use Dropbox. My Eclipse workspace is inside my Dropbox folder, so whenever I load up Eclipse on any of my computers, I always have the most updated versions of my files without any hassle.
This also gives you the added benefit of not having to worry about a harddisk failure and being able to rollback files.

Either do as Glendon said or setup a subversion or git repository.
I usually do both.

If you're not using Dropbox or github, I assume you're emailing the code or using a USB drive. After you've unzipped your project to your other computer's home directory, run Eclipse and do
File, New, Android Project
enter the Project Name
in Contents, select Create project from existing source
in Location, browse to the directory you just created in your home directory
choose a Build Target
and click Finish assuming the other settings have been filled in for you.

I do the same thing by putting a bare git repository on a memory stick and cloning it onto all development machines.
As the repositories on the development machines are cloned from the one on the stick, their "origin" will point back to the memory stick. So all I have to do when bouncing from one development machine to the other is
<insert memory stick>
cd <work_directory_on_harddisk>
git pull
...write code
git push
<remove memory stick>
and I am done.
What is nice about this is that even if you forget the stick, or forget to synchronize and end up working on an outdated directory, you can untangle it easily with all the power of git.

Related

git eclipse pulls no project

I am new to working with repositories.
I'm forced to work with my team on academic project using git. My job is to write Android app.
The problem is when I wrote it, then pushed it to repo I want to pull it on different machine.
But when I pull it, I get only "source" files, no: (for example) R.java.
Moreover: I wanted to use "Clean project" Option, but it seems, that my Eclipse is not treating the pulled files as project (when I click "Clean..." I can choose any project in my workspace, but the download one is lacking).
Anyone could help me?
EDIT:
I've solved the problem:
Git doesn't push to repository automatic-generated files, like R.java. After you pull it back, you have to Clear project and rebuilt it. If it still doesn't work: try restarting Eclipse

How do I export an Android Studio project?

I just started using the Android Studio IDE and I already released and published a simple APK to Google Play store.
The problem is that I did this at work.
Now I downloaded the Android Studio at my home and I want to continue working and fixing bugs on my Project.
I see that there is Import Project in the Android Studio home screen, but from where I export the project in order to import it?
I tried Zipping my whole Project folder and import it but it didn't work very well.
In the Android Studio go to File then Close Project. Then take the folder (in the workspace folder) of the project and copy it to a flash memory or whatever. Then when you get comfortable at home, copy this folder in the workspace folder you've already created, open the Android Studio and go to File then Open and import this project into your workspace.
The problem you have with this is that you're searching for the wrong term here, because in Android, exporting a project means compiling it to .apk file (not exporting the project). Import/Export is used for the .apk management, what you need is Open/Close project, the other thing is just copy/paste.
As mentioned by other answers, as of now android studio does not provide this out of the box. However, there are ways to do this easily.
As mentioned by #Elad Lavi, you should consider cloud hosting of your source code. Checkout github, bitbucket, gitlab, etc. All these provide private repositories, some free, some not.
If all you want is to just zip the sources, you can achieve this using git's git archive. Here are the steps:
git init # on the root of the project folder
git add . # note: android studio already created .gitignore
git commit -m 'ready to zip sources'
git archive HEAD --format=zip > /tmp/archive.zip
Note: If you intend to send this by email, you have to remove gradlew.bat from zip file.
Both these solutions are possible thanks to VCS like git.
It seems as if Android Studio is missing some features Eclipse has (which is surprising considering the choice to make Android Studio official IDE).
Eclipse had the ability to export zip files which could be sent over email for example.
If you zip the folder from your workspace, and try to send it over Gmail for example, Gmail will refuse because the folder contains executable.
Obviously you can delete files but that is inefficient if you do that frequently going back and forth from work.
Here's a solution though:
You can use source control. Android Studio supports that. Your code will be stored online.
A git will do the trick. Look under "VCS" in the top menu in Android Studio.
It has many other benefits as well. One of the downsides though, is that if you use GitHub for free, your code is open source and everyone can see it.
Source control is best way to handle this problem, if you don't want to pay then try bitbucket
It's free, allows private repo for upto 5 members team.
Windows:
First Open Command Window and set location of your android studio project folder like:
D:\MyApplication>
then type below command in it:
gradlew clean
then wait for complete clean process. after complete it now zip your project like below:
right click on your project folder
then select send to option now
select compressed via zip
Apparently, there's a lot of "dead wood" in the "build" directories of a project.
Under linux/unix, a simple way to get a clean, private backup is to use the "tar" command along with the "--exclude=String" option.
For example, to create an archive of all my apps while excluding the build directories, I have a script that creates the following 2 commands :
cd $HOME/android/Studio
tar cvf MyBackup-2017-07-13.tar Projects --exclude=build
For Android Studio below 4.1:
From the Top menu Click File and then click Export to Zip File
For Android Studio 4.1 and above:
From the Top menu click File > Manage IDE Settings > Export to Zip File ()

How to get my Android project from one computer to the other?

I have a laptop that I'm using to work on my app in Eclipse. I share the computer so it's not always available. How can I get the entire Android project from my laptop's Eclipse to the Eclipse on my PC? I don't want to email each individual file to myself and open it on the PC, either.
If you just want to copy your project from one computer to another, on the first one choose in eclipse: File->Export...->General->Archive file, then select project(s) to export, choose archive name and format and save it. Copy archive file to second PC. In the second eclipse choose: File->Import...->General->Existing Projects into Workspace->Select archive file. Select your archive, select project(s) to import. Voila!
If you want your project's source code to be open on the public, you can use github or Google code or something similar. Then you should install a plugin to Eclipse in order to be able to synchronize easy your code.
At my early steps, I was using Dropbox for project synching. It was good for projects that only one person writes to them. If many people participate, then this solution is a mess.
Also you can set up your own sych server, if you have a pc that is online 24/7 or when you need it. I tried to set up a Gitorious but I haven't managed to get it running 100%. So, for now I have an SVN server, and using the Eclipse plugin for SVN synching, I have everywhere I want my eclipse projects. To setup an SVN synch server is very easy and will not take more than a few hours(minutes??).
I'm surrounded by computers all day long, but I don't have access to install anything on them. My solution is that I made a Lubuntu Live USB drive that I then installed Eclipse and the Android dvelopment tools on. Luckily the BIOS is not locked on any of the computers so I boot the closest computer up using my USB drive as the OS and everything is exactly as I left it no matter which computer I'm at. When I am at home and I want to code I boot my desktop or laptop up using that drive as well.

android eclipse driving me mad?

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.

Moving Android/Eclipse project to new PC

Well, I hosed up my Android development PC, but didn't care all that much since I really needed a newer, much faster PC for this work. And here I am now with a high-end Windows 7 64-bit box.
Eclipse and all the Android components are up and running, but the one thing I'm having trouble with is how to get my previous project into the new workspace. I copied over my entire old workspace directory from the old disk and made that my Eclipse workspace, but it doesn't automatically see the projects that are there. I tried creating a new Android project "from existing source", but it complained about having "overlapping projects" or some such.
Is there a way to have it recognize the existing project files, or should I move them somewhere else, create the project from scratch, and then copy the old files back into the project tree? Or any other solutions?
A super easy way is by just doing an Import.
Select File Import.
Select Existing Projects Into Workspace and click next.
Select the directory of the project file.
Click Finish.
You will have to do this for each project. Note, that you may need to remove the project folder that you copied into the workspace manually, because this procedure will automatically copy the folder and hierarchy for you.
I used this method to code on my home machine as well as a development environment running from a live CD while attending classes in the computer lab.
Get Dropbox.
Put your workspace in a Dropbox folder.
Point the new machine's Eclipse install to your
Dropbox workspace folder after it
has updated itself.
Get back to coding.
Hope this works for you. It did for me.
There was one other complication. On my "old" PC I had been using Eclipse Helios, which apparently has some minor compatibility issues with ADT, so on my new PC I went with Galileo instead, and there might be some differences in existing files in the project directory.
In any case, what I did was to move my old project directory to a temp location, create a new project in Eclipse with the same name and basic settings, close Eclipse, copy my whole directory tree back into the new project directories, and then restart Eclipse. Eclipse bitched a bit about something, then went ahead and rebuilt everything.
I'm back in business! Thanks for all the responses.
BTW, the entire install process took a long time since I wasn't sure whether to install 64-bit Java or 32-bit (32-bit was required), etc. But it's nice to be running on a clean, fast PC instead of one that's been accumulating general crud for several years.
Move each of the projects in your hard disk to the new PC's workspace, or wherever you want to have them. Do not copy the metadata folder!. Then create new projects from existing sources (yes, you'll have to manually do this for each of the projects)
Ger
I know that this is old question but it is a issue I ran into when moving my project over from my home theater PC to my new laptop so I can leave my HTPC to doing HTPC things. Anyways what I did was I imported my project from over the computer over the network to my new laptop using new android project from existing code. The files where populated but it changed my root folder name. Being OCD I wanted to change the name of the root folder back to what I had on the other machine. I found if I right clicked the item in the project tree and selected refactor I could rename it back to what it was on my HTPC. This then resulted in my laptop having a exact working copy of the code so I can program from here.
You can copy whole Workspace just through import>General>Existing Projects into Workspace>Select root Directory>finish
Have you checked if the export/import eclipse mechanim works fine with 2 linked projects: android and app engine?

Categories

Resources