Skip to content

dylanninin/first-android-app

Repository files navigation

First Android App with Kotlin

Main

Tutorial

tutorial: Build Your First Android App in Kotlin

features

  • toast: by clicking this button, toast message shows, and then dismisses in seconds.
  • count: by clicking this button, integer increases from 0 by 1.
  • random: show random integer between 0 and counted number.
    • counted number updated by clicking the "count" button
    • by clicking the "random" button, next page will show a random integer between 0 and counted number
    • this counted number was passed through navigated pages via "androidx.navigation.safeargs"
  • http: with retrofit2, by clicking count button, send request to httpbin.org

Screenshots

Development

build from command line

# list all tasks
./gradlew tasks

# build debug apk
./gradlew assemble

# apk path
ls -lh app/build/outputs/apk/debug

deploy to emulator

# ensure path in bash_profile/zshrc/...
# see https://stackoverflow.com/a/49511666/1448139
# e.g.:
export ANDROID_SDK=~/Library/Android/sdk
export PATH=${ANDROID_SDK}/emulator:${ANDROID_SDK}/tools:${ANDROID_SDK}/cmdline-tools/5.0/bin:${ANDROID_SDK}/platform-tools:$PATH

# list all emulators
emulator -list-avds

# start emulator
emulator -avd Pixel_5_API_30

# install use adb
adb install app/build/outputs/apk/debug/app-debug.apk

Issues

issue1: navigation-safe-args

issue2:

Reference