Skip to content

Set up environment

mirontoli edited this page Oct 10, 2011 · 25 revisions

Table of Contents

Download and install the following things

  1. Eclipse Classic
  2. JRE (Java Runtime Environment)
  3. JDK (Java Development Kit)
  4. Android SDK (Software Development Kit)
    1. Install all API (Application Programming Interface) levels (even Google API's)
    2. Create a new AVD (Android Virtual Device), that should be Google API 2.2 - level 8 - 512 MB memory
  5. Git client; MsysGit (if you use Windows) or git extensions.
  6. Configure Git by following this guide (if you use Windows)
  • A few pointers:
    • Toward the end a randomart image might not show up. It is okay if it does not as you do not need it right now
    • You will also get a key fingerprint (MD5 fingerprint) at this step. Save that for now (you need it later when you want to obtain your own Google Map)
    • When you are at the step of getting a SSH key make sure you get the right one. In your folder there should be two id_rsa files; one id_rsa and one id_rsa.pub (it is the .pub you want). This might be disguised as a Microsoft Office Publisher document, so do not be fooled by that...

Start Eclipse and do the following

  1. Install and configure Android ADT (Android Development Tools)
  2. Install EGit in Eclipse (Help > Install New Software... > "Available Software Sites" > Search for 'egit')
  3. Change SSH directory in Eclipse (Window > Preferences > Search for 'SSH2' and click on that option > Your SSH2 home folder should be something like C:\Users\[your name]\.ssh) <--- notice that there is a dot before 'ssh'. This one is important!
  4. Set up your personal Google Map by doing the following:
  • Go to this site. Check the checkbox and fill in your MD5 fingerprint (you should have got one when you configured Git). You will now obtain an API (Application Programming Interface) key
  • Go back to Eclipse and go to LUSitesActivity > res > layout > main.xml and find the commentary close to the end of the code. Fill in your API key (development key) in this commentary. After that, find the attribute that says android:apiKey in main.xml and paste your API key here as well (note: do not commit this file at any time. This is your own personal key for getting the Google Map to work in the emulator. If you commit this the key will be the same for all others who work on this project but the map will only work for you)

GitHub

  1. Create an account on GitHub
  2. Become a LUSites contributor (by contacting the admin)
  3. Add your public SSH key on GitHub (if you have not done this before during the configuring of Git)
  4. Checkout from GitHub in Eclipse (File > Import... > Git > Projects from Git > Clone... > URI: git+ssh://git@github.com/mirontoli/Lusites.git and click Next > Enter your passphrase, from when you configured Git > Select Master and click Next > Directory: C:\Users\[your name]\Lusites > Finish)
  5. Use the New projects wizard to import the project, because you should not copy it to your workspace! (see Import LUSites to Eclipse on how to do this)

Using Git/MsysGit/Egit

For a crash course, see this link.

The basic steps are

  1. Add - whenever you add a new element (class, file, image...) there will be a small question mark next to this element (instead of the regular yellow cylinder). To fix this right-click on the element and select Team > Add
  2. Commit - Whenever you changed something in an element a > sign will be visible next to the element (this means that you have not committed the changes yet). To fix this right-click on the element and select Team > Commit... > Fill out a commit message i.e. what you have changed and check the checkboxes on what you want to commit > Push the commit button
  3. Push to Upsteam - First things first, here you need to have the Git Repositories tab open. To get this tab, go to: Window > Show View > Other... > Git > Git Repositories. Now, in this tab you can push your repository to this page. To do this, you need to right-click on your repository (LUSites) and click Push to Upsteam. This will then publish the changes you have committed before (all of them, at the same time). Others will then have the pleasure of seeing, and downloading, the hard work you have put down on improving this app!
  4. Pull/Fetch from Upstream - Sometimes you cannot use the option Push to Upsteam. This is because someone else has been modifying the elements which you have been working on and you need to download their updated versions first. You do this by Pulling or Fetching, which is done by right-clicking on your repository (LUSites) and click Pull/Fetch from Upstream. You will then get the latest version of the app and you may then publish your changes.

Get code manually

  • mkdir test
  • cd test
  • git init
  • git remote add origin git@github.com:mirontoli/Lusites.git
  • git pull origin master

map key

Create a fingerprint first. Windows: "C:\Program Files\Java\jdk1.6.0_24\bin\keytool.exe" -list -alias androiddebugkey -keystore C:\Users\MyUserAccount\.android\debug.keystore -storepass android -keypass android > C:\Users\MyUserAccount\Desktop\fingerprint.txt

You can’t perform that action at this time.