Skip to content
This repository has been archived by the owner on Oct 25, 2018. It is now read-only.

2. Your First Clone

Azri Azmi (Aba) edited this page Jun 10, 2015 · 11 revisions

Using version control with Android Studio projects is interesting. Sometimes things work and then suddenly things fall apart. Based on experience, most (if not all) auto-generated & auto-modified project files and directories have been added to gitignore.

Because of this though, the first time set up of this project will not be the easiest. But when you have this done, it's all smooth sailing.

Step by Step

You'll see some of these overlap with instructions in the next documents. Part of the steps is basically creating essential files with dummy data.

  1. In Terminal, navigate to any directory of your liking and clone the repo..

    git clone https://github.com/uw-it-aca/spacescout-android.git
    
  2. In Android Studio, choose "Open an existing Android Studio project" or go to 'File > Open' and navigate to where the 'spacescout-android' directory is located and choose it, which may have the Android Studio icon (it's ok if it doesn't).

  3. When you first open the project, you'll see a prompt "Unregistered VCS root detected" (it may be on the status bar at the bottom of the window). Choose 'Add root'. If the prompt disappears, click on the status/message bar at the bottom-most part of the IDE.

    3.1. You may also see a prompt about importing a gradle project and notice the absence of the project folder in the 'Project' tab on the left-hand sidebar. If this happens, click on the "Import Gradle Project" on the prompt and choose the Recommended setting (something with "Wrapper") which should point to a file called "build.gradle", and continue. It will start loading things. If the prompt disappears, click on the status/message bar at the bottom-most part of the IDE.

    3.2 [SPECIAL CASE] This happens if you already have the project on local, but you switched branches or pulled new things. You may not see the prompt in 3.1, but you won't see your project directory (even though it builds fine) and you'll notice that you can't run the app. Repeating step 2 seems to solve this.

  4. Android Studio may try to build and will prompt for any missing SDKs. Just install them. After you finish installing, it will still fail to build. So, let's continue.

  5. In the 'Project' tab on your left, navigate to 'SpaceScout/res/values/' [Android View] and create a file called 'secrets.xml' (we're specific because it's already in the gitignore file). To do this, right click on the values directory and choose 'New > Values resource file'. Do not add to git on prompt. The file should contain these:

    <?xml version="1.0" encoding="utf-8"?>
    <resources>
        <string name="googleMapsKey">AIzaSyBdVl-cTICSwYKrZ95SuvNw7dbMuDt1KG0</string>
        <string name="consumerKey">23k4k1k09470c6d2ff23665bf588fb91773bnm65</string>
        <string name="consumerSecret">m67jkace11b5cfc004e7fb1d6321f92ca7e0980a</string>
        <!-- Default urls -->
        <string name="urlAll">http://dnsname:8000/api/v1/spot/all</string>
        <string name="baseUrl">http://dnsname:8000/api/v1/</string>
    </resources>
    

    The keys are fake

  6. Go to menu and select 'Build > Rebuild Project' and 'Build > Clean Project'.

  7. Try to run the app on an AVD. If it runs (with the "Connection Error" prompt), it works.

Now you can proceed to Getting Google Maps to Work.