Skip to content

Configuring Development Environment

wnayes edited this page Dec 22, 2012 · 5 revisions

Cloning Source Code (Windows)

  • Install any version of Git for Windows if not previously installed.
  • Run the Git Bash once installation is completed.
  • Navigate to a folder where you want to store the project files. I would choose either C:\ or C:\Users\user\Documents\. Note that in the Git Bash directories in C:\ must be accessed with forward slashes, for example cd /c/Users/user/Documents.
  • git clone https://github.com/wnayes/app-challenge-android.git
    The repository should now be in a app-challenge-android folder.

Setting up Eclipse

  • Either install the Android SDK and Eclipse manually or grab the ADT Bundle.
  • Library files are not included in the repository, but need to be added to build. Copy the file <sdk-folder>/extras/android/support/v4/android-support-v4.jar into repository\app\libs\. The SDK folder is the location of the Android SDK downloaded previously.
  • You may have to also add it as an "External JAR" from the Libraries -> Java Build Path configuration.
  • Import the project into Eclipse. From File -> Import, select Existing Android Code into Workspace. The root folder is the app directory.

Getting Google Maps to compile

There are a few extra steps to prevent the application from crashing with Maps in an Activity.

  • You will need to get a Google Maps API Key for yourselves. One tricky part was finding the keytool application; it was in the C:\Program Files\Java\jdk_*\bin\ for me. You will need to get the SHA-1 hash output and create a new Android key from the Google API Console.
  • We will each have separate keys (not committed to the repository). So to configure this, create a maps_key.xml file in app\res\values. In this file, write:
    `
YOUR_KEY_HERE ` * We need the Google Play Services library to be included with our application. This comes with the Android SDK. First, in Eclipse, choose "Import -> Existing Android Code into Workspace" and find the folder `/extras/google/google_play_services/libproject/google-play-services_lib`. Then, right click the `app` workspace entry, hit "Properties", and enter the "Android" section. Add this imported code as a Library. * I still had issues at this point building until I read [this page](http://stackoverflow.com/questions/13733911/google-maps-android-api-v2-sample-code-crashes). Similar to above, copy the `google-play-services_lib.jar` file into our `app/libs` directory and add it as an "External JAR".

ActionBarSherlock

We currently have a compatibility library for using the ActionBar UI in android releases predating Honeycomb. This is another library that needs to be downloaded, added to the Eclipse workspace, and added to the main project before compiling. For more information, see the library website.

Running an Android app with Google Maps in the emulator

Unfortunately, it seems it is also a huge ordeal to get apps using the new Maps API v2 to keep from crashing/displaying a message about Google Play Services needing to be installed. If you can find access to a physical device to run the app on, it should work with no issue. There are workarounds to get the emulator working; I tried some workarounds from here and they seemed to work (at least temporarily?). It sounds like there could be updates to the SDK making this unnecessary but for now it is.