Friday, January 27, 2012

offline android development

if you ever find yourself with time on your hands and no internet (maybe waiting at the airport and like me, too cheap to pay $5 for a measly couple hours of internet), have no fear, you can still do android development. but you'll have to plan ahead, and set up a few things while you do have internet:


  • git
    so we all know git is a great, super-fast way to keep track of revisions in a decentralized way. because it's decentralized, you can commit changes to a git repository without any internet access. just make commits as you normally would, and then the next time you have internet you can push them to a remote repository like github.
    if you won't have internet access on your development machine, you can still update a remote repository by using a flash or other external drive:


    1. plug in your flash drive, and change to a directory where you wish to store a clone of your git repository:
      cd /media/my-flash-drive/some-folder


    2. clone your repository onto the flash drive:
      git clone git://example.com/myrepo.git


    3. now that you've got a clone of the repository, next time you're developing offline, you can pull local changes into the clone of the repository on your flash drive, like so:
      cd /media/my-flash-drive/some-folder
      git pull /home/myuser/path/to/repo


      if it gives you an error about specifying a branch, try tagging "master" to the end of the command, like so:
      git pull /home/myuser/path/to/repo master



    4. then, next time you're online, plug your flash drive in, and push the repo to your remote repository:
      cd /media/my-flash-drive/some-folder
      git push -u origin master


    I've got some basic git documentation on my wiki, but github's got better documentation on their help site.


  • android developer documentation
    unless you've got the android developer documentation memorized, you might find it handy to be able to access it offline. this one's really easy if you've followed their instructions on setting up the android SDK:


    1. open the android SDK manager using the instructions here: http://developer.android.com/sdk/adding-components.html#launching


    2. expand the latest version of the android API, underneath it check the Documentation for Android SDK, click Install, and follow the instructions.


    3. when it's finished installing, using a web browser navigate to the docs folder in the folder you installed the SDK, and open offline.html. the cool thing is that search works, even offline!









of course you'll need to have the SDK installed as well, but I don't mention that here because you kinda need to have that installed anyway.


have fun!

1 comment: