15. GUI Application
17. Web Application

16. exercise: Android Application

General steps

Set up IDE

  1. Install Android debugger:

    sudo apt-get install android-tools-adb
  2. Download from bcserver (or from and extract it in proper place.

Create simple test project

  1. Select Start new Android Studio project.
  2. Review proposed names and press Next.
  3. Select Phone and Tablet and choose API 26: Android 8.0 (Oreo) and press Next.
  4. Select Basic Activity and press Next.
  5. Review proposed names and press Finish.

Set up SDK and AVD

To be able to compile and run Android project, you have to have compatible set of:

  1. project settings (for which version of API it will be compiled (declared in app/build.gradle file),
  2. appropriate libraries for compiler and Android runtime (SDK),
  3. physical (i.e. your phone) and/or virtual device (AVD), which supports chosen API version.

Set up SDK

  1. Select Tools — SDK Manager.
  2. Click on Android 8.0 (Oreo), 26, 2 .. and press OK.

Set up AVD

  1. Select Tools — AVD Manager and clic on + Create Virtual Device.
  2. Select Phone, 2,7" QVGA and press Next.
  3. Select Oreo, 26, x85, Android 8 (Google APIs) and press next.
  4. Review proposed name of AVD (name should show API version) and press Finish.

Run simple test project

  1. Select menu Run — Run....
  2. Select MainActivity.
  3. Select 2.7 QVGA API 26 (Android 8.0.0., API 26) virtual machine and press OK.
  4. Check that application works properly (i.e. clicking on envelope shows pop up menu).

Clone and implement actual project

  1. Clone project:

    cd ~/AndroidStudioProjects
    git clone Android_abcd

    where abcd is your unique code

  2. Change configuration files:

    1. In app/src/main/res/values/strings.xml file change line:

      <string name="app_name">Android_abcd</string>
    2. In app/build.gradle file change line:

      applicationId "jtm.android_abcd"
      where abcd is your project code in lowercase letters (because by convention Java packages have only lower case letters).
  3. In Android Studio welcome screen select Import project (Gradle, Eclipse ADT, etc.)

    Importing project instead of directly opening goes better, if there are configuration changes caused by newer version of the Android Studio.
    1. Select Android_abcd project and press OK.
    2. Check for warnings and suggested fixes, if project needs to be upgraded.
  4. Implement class of the application, to allow user changing background color of screen using sliders representing RGB colors.
  5. Check that unit tests are passing:
    1. — JUnitTest — JUnit unit test,
    2. — AndroidTest — Android GUI test.
  6. Change existing remote repo entry or add new remote repo entry to the bcserver
  7. Put your project as another project Android_abcd on bcserver, by following exercise 2.1
    (with importand difference, that now your project is named Android_abcd).

More info

  1. including:
  2. Change background color, by SeekBar

15. GUI Application
17. Web Application
Izveidojis Valdis Vītoliņš 2018-03-26 10:58
Pēdējais mainījis Valdis Vītoliņš 2019-02-06 16:06
Xwiki Powered
Creative Commons Attribution 3.0 Unported License