Milestone 1

due at midnight on   +125

For this milestone, you will get a basic Android project working in the emulator. Optionally, you can also set up a physical Android device to run the app.

To begin, open the Android Studio application. If you already have a project open, use File » Close Project so you can see the Welcome screen.

Welcome to Android Studio

Welcome to Android Studio

  1. Choose Start a new Android Studio project.
  2. Make the Application name “My First App”. The Company Domain can be any domain-name format you like, so feel free to use your own domain name if you have one. Or something like Change the Project location to your cs164 folder – so it should end with cs164/MyFirstApp
  3. On the next screen, accept the defaults: Phone and Tablet, API 15.
  4. On the next screen, choose Blank Activity.
  5. The final screen will ask for names of activities and layouts. Just accept the defaults.

The project can take a few minutes to set up and index the files.

You may now want to open your Git GUI, and commit the initial project before you make any changes to it.

Before we start to modify the project, let’s try to run it in the emulator, to see whether the basics work. Hit the green play button on the Studio toolbar. At first it will say “Waiting for ADB,” and then the progress bar will switch to the bottom of the window where it says “Gradle: executing tasks.”

Then a window will pop up, offering to choose a running device. You can try that if a device appears there, but if not, then choose “Launch emulator.”

It can take a while for emulator to finish initializing. When you see the home screen (time and date, lock icon at the bottom), drag the lock upwards to unlock. If the screen is blank, it might have gone to sleep – just click on it. Once unlocked, the app should appear, with its “Hello world” message.

If you have problems up to this point, post them to Piazza.

The rest of this milestone was covered well in lecture on Feb 2, take a look at the video if you missed it. For the rest of this milestone, please try:

  • In the android app, add a button to the screen, and an action that takes place when you push the button (such as changing or moving some text).

  • In a different class, create a static method that performs some calculation, and some test code to automatically test the results.

In the video, I didn’t get JUnit to work completely, so it’s not required for this milestone, and I’ll post better instructions later.