Showing posts with label Installation-Guide. Show all posts
Showing posts with label Installation-Guide. Show all posts

Thursday, 13 January 2011

Setting up PhoneGap for Android on Windows 7

Everything I see shows this on a Mac, so here are my notes on getting up to speed for Windows 7.

Preparation (Reading and Downloading)

Start with the generic Android Eclipse quickstart here: http://wiki.phonegap.com/w/page/30862722/phonegap-android-eclipse-quickstart

It tells you that you need the Android SDK which you download here (this is the start of a veritable download fest):
http://developer.android.com/sdk/index.html (31.2MB)
NB. I recommend the ZIP, not the EXE; you'll see why when you read the installation.

You read the notes and see you should follow the guide to installing the SDK:
http://developer.android.com/sdk/installing.html

You might need the JDK, or a newer version. Download from here:
http://www.oracle.com/technetwork/java/javase/downloads/index.html
Note to self: This site expects you to know what edition and version you need rather than telling you or helping you decide. (You need JavaSE dummy.) (66.9MB)

You'll need the IDE as well, and this should be Eclipse Classic. Get it here:
http://www.eclipse.org/downloads/ (170MB)

Installations

Installation order:

  1. JDK (jdk-6u23-windows-x64.exe)
    Unsure of the options, the only thing I skipped installing was the source code. Also installed to D: rather than C: (space). Note that the JRE is actually a 2nd installation kicked off from the former, so you have to change the installation drive again here. Sidenote: Oracle want me to register, and to do that I need to create an account. Just to use Java? No thanks.
  2. Eclipse (eclipse-SDK-3.6.1-win32-x86_64.zip)
  3. Android SDK (installer_r80-windows.exe)
    Even though the JDK has been installed, this installer says it can't find the JDK and progress is blocked. You can't tell it where the JDK is; you can only exit. A reboot doesn't address this issue. I try by copying the entire D:\Program Files\Java\jdk1.6.0_23 to C:\Program Files (x86)\Java\jdk1.6.0_23 with no luck. I then add the bin folder to the PATH environment variable (Computer/Properties/Advanced System Settings/Advanced/Environment Variables.) Still no luck. At this point I give up on the installer and download android-sdk_r08-windows.zip (31.2MB) whilst cursing the installer for it's refusal to cooperate.
    I extract the contents to D:\Dev\android-sdk-windows and run SDK Manager.exe to download the packages I want/need. (I rejected the oldest libraries.)

By now I've done steps 1 and 2 of the SDK installation guide. On to Step 3: Installing the ADT plugin for Eclipse:
http://developer.android.com/sdk/eclipse-adt.html#installing. It's installed through Eclipse, so not a download I could easily measure in size. It's apparently around 8MB if you download it manually. At last we have a step that feels as painless as a typical Windows installation.

I realize at this point that I jumped the gun when I ran the package manager and installed those packages. The installation guide suggests doing that now. Though it's not made any difference - everything seems to work fine now.

Apparently we're done and we can get back to the QuickStart and making that first PhoneGap Android application. Woohoo!

Friday, 11 June 2010

Quick and simple Mercurial (Hg) setup

I thought the time had come for me to get to grips with a DVCS having heard so much love for Git and Hg. The first big decision; Hg or Git? And this is a tough one, because everything I've heard about the two indicates that there's only minimal differences. Someone I know at work has been trying Git, so to get a comparative test I thought Mercurial. Besides, I prefer the name Mercurial (heard about it before Git) and I like the references to the periodic table of elements (Hg); it tickes my geek.

Joel Spolsky wrote a great guide that's available at http://hginit.com/. It's great not only because it helps show people the path to DVCS from SVN (or similar VCSs) but because he does it with the right amount of humour. Even if you don't want to adopt Hg or Git, it's a fun read.

But it jumps right in assuming you, or your IT support team, have already installed Mercurial for you. So here's my guide to getting it all installed and configured.

Where to get the goods:

  1. Get the actual Mercurial installation here: http://mercurial.selenic.com/ 5.91MB
  2. Get VisualHG, a Mercurial Source Control Plugin for MS Visual Studio here: http://visualhg.codeplex.com/ 337kb
  3. Get TortoiseHg here: http://tortoisehg.bitbucket.org/ 21.4MB

Total download: 27.6MB

Installation

Since the first download is an MSI there's really not much to is. Run the MSI. I chose not to install the translations. At the time of writing this was Mercurial 1.5.4. Installation was uneventful as expected. It installed to C:\Program&nsbp;Files&nsbp;(x86)\Mercurial. You guessed it, I'm running 64-bit Windows 7 and Mercurial installed 32-bit. Ho hum. The start menu folder contains links to things like help on the configuration file that made me think I was on Unix again and nearly run for the hills. So I ignored that for now. The link to the command reference seemed equally foreboding so I just opened a command line prompt to see what "hg" would do. At last, a simple list of commands. That confirmed I had it installed and from here I could follow Joel's superb tutorial if I wanted.

Much as I love the command line. Really; I do. Maybe because my first experiences with an IBM PC were with DOS, who knows. Nevertheless, I know that I will not check in as frequently as I ought to if I have to drop to the command line rather than perform these tasks from within my IDE of choice. My IDE of choice is of course, Visual Studio. I love it and I HATE it. But there seems no viable alternative at the moment, so I try focus on the love I have for it. Time now for the second install - VisualHG from CodePlex.

Again, this is an MSI, so it's so straight forward it's practically boring. Again 32-bit (installed to C:\Program Files (x86)\VisualHG\ by default). Installation was particularly quick. One of those moments when you wonder whether it installed correctly. Their installation instructions call for installing TortoiseHg, but I don't feel a need for Explorer integration so I'm not installing that - yet. It's as simple as opening Tools-Options and selecting VisualHG from the Source Control Plug-in selection drop down box. I'm again surprised by how simple this is. I am beginning to feel that sense of pending doom: it's easy; too easy...

Now creating a new project under Mercurial control might not be easy - I've not created a repository yet. Let's see...

Created a new ASP MVC 2 web application. An attempt to commit tells me it's not under Mercurial source control. Well duh. Time to refer to Joel's tutorial...

I go to the folder where the files are, just like he tells me to, and I type "hg init" and hit Enter. Nothing. Ah but hang on, Joel said that would happen. Look and see that the ".hg folder is there". Amazed; I pause. Nothing has ever been that fast before, not even Subversion. I savour the moment. If this is a sign of things to come, bring it ON!

First issue occurs after I've done "hg add" and I try "hg commit". It throws this back at me:

abort: no username supplied (see "hg help config")

I'm starting to guess here. It tells me where it'll look for configuration files so I create a new text file in "C:\Users\bhofmann" called "Mercurial.ini" that it should read from. The contents resemble the following:

[ui]
username = Bernhard Hofmann
verbose = True

I try the "hg commit" command again and woot! It opens Notepad with a list of the files (just like in Joel's tutorial). I exit and save, and it whirls through the files. Maybe there's a plugin for AD support or something, because the ability to spoof identities seems too easy. Still, I trust me and I'm the only one using this repository - for now.

Back to Visual Studio to see what's happened there...

It would appear that TortoiseHg is indeed required for VisualHg. I decide to watch Rob Connery's video: http://tekpub.com/codeplex. As good as the video is, my time is limited and it's WAY too slow.

I install the 64-bit TortoiseHg MSI. Once again installation is boringly simple and robust. Kudos to the testers on all these products.

Start Visual Studio and the difference is obvious - suddenly I have icons showing the status of each file. Sadly the pending changes and source control explorer windows are TFS-only tools.

Job done - I can edit, commit, see history and revert files all from within VS2010.

Next steps will be to see how I push up to a central repository, and how I make backups. Or maybe that's just a question of having another repository I push to?